4 This allows PHP scripts to control
[UnrealIRCd](https://www.unrealircd.org/)
5 via the
[JSON-RPC interface](https://www.unrealircd.org/docs/JSON-RPC).
7 Currently this is just a proof-of-concept:
8 * It allows you to connect only using websockets
9 * It has only
1 function (
`query`) to send a JSON-RPC request and receive a response,
10 which is low-level. You need to know *exactly* what method to call and with
11 what parameters. So there is no
`listUsers` or things like that.
12 * There is only limited error checking
15 This is just a proof-of-concept to get things going and to see if there
16 is interest in making it a more serious library. A serious library would
17 abstract everything and provide functions such as
`listUsers`,
`listServerBans`,
18 `addServerBan`, etc. That way the programmer using it would not need to
19 know anything about JSON-RPC at all.
21 If you are interested in helping out to achieve that, join us at
22 #unreal-webpanel at irc.unrealircd.org (IRC with TLS on port 6697).
24 See also
[Looking for webdevs to make UnrealIRCd webpanel](https://forums.unrealircd.org/viewtopic.php?t=9195),
25 both the
1st and
2nd post there in particular.
30 composer require unrealircd/unrealircd-rpc
37 require dirname(__DIR__) . '/vendor/autoload.php';
39 use UnrealIRCdRPC\Connection;
41 $api_login = 'api:password';
43 $rpc = new UnrealIRCdRPC\Connection("wss://127.0.0.1:8000/",
45 Array("tls_verify"=>FALSE));
47 $bans = $rpc->query("server_ban.list");
48 foreach ($bans->list as $ban)
49 echo $ban->type . " at " . $ban->name . "\n";