PHP SDK
Installation
composer require sending-network/sdn-php-sdkUsage
Prepare a configuration file
{
"nodeUrl": "https://portal0101.sending.network",
"walletAddress": "<WALLET_ADDRESS>",
"privateKey": "<PRIVATE_KEY>",
"developerKey": "<DEVELOPER_KEY>"
}Create an instance of SDNClient
SDNClientrequire('vendor/autoload.php');
use SdnSdk\SDNClient;
$json_data = file_get_contents("bot.creds.json");
$config = json_decode($json_data,true);
$client = new SDNClient($config['nodeUrl']);
// login
$token = $client->login($config['walletAddress'], $config['privateKey'], $config['developerKey']);
// add listener for events
$client->addListener(function ($event) {
// process room event here
print_r($event);
}, "m.room.message");
// start listen
$client->listenForever();Call API functions
Examples
Last updated