承接 unrealircd/unrealircd-rpc 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

unrealircd/unrealircd-rpc

Composer 安装命令:

composer require unrealircd/unrealircd-rpc

包简介

JSON-RPC interface to UnrealIRCd

README 文档

README

This allows PHP scripts to control UnrealIRCd via the JSON-RPC interface.

This library is used by the UnrealIRCd webpanel.

If you are interested in helping out or would like to discuss API capabilities, join us at #unreal-webpanel at irc.unrealircd.org (IRC with TLS on port 6697).

Installation

composer require unrealircd/unrealircd-rpc:dev-main

UnrealIRCd setup

UnrealIRCd 6.0.6 or later is needed and you need to enable JSON-RPC in it. After doing that, be sure to rehash the IRCd.

Usage

For this example, create a file like src/rpctest.php with:

<?php
    require dirname(__DIR__) . '/vendor/autoload.php';

    use UnrealIRCd\Connection;

    $api_login = 'api:apiPASSWORD'; // same as in the rpc-user block in UnrealIRCd

    $rpc = new UnrealIRCd\Connection("wss://127.0.0.1:8600/",
                        $api_login,
                        Array("tls_verify"=>FALSE));

    $bans = $rpc->serverban()->getAll();
    foreach ($bans as $ban)
        echo "There's a $ban->type on $ban->name\n";

    $users = $rpc->user()->getAll();
    foreach ($users as $user)
        echo "User $user->name\n";

    $channels = $rpc->channel()->getAll();
    foreach ($channels as $channel)
        echo "Channel $channel->name ($channel->num_users user[s])\n";

Then, run it on the command line with php src/rpctest.php

If the example does not work, then make sure you have configured your UnrealIRCd correctly, with the same API username and password you use here, with an allowed IP, and changing the wss://127.0.0.1:8600/ too if needed.

统计信息

  • 总下载量: 1.65k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-26