JSON-RPC interface to UnrealIRCd

dev-main 2023-05-08 06:28 UTC

This package is auto-updated.

Last update: 2023-09-08 07:10:37 UTC


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).


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.


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

    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://",

    $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:// too if needed.