PHP code example of sending-network / sdn-php-sdk
1. Go to this page and download the library: Download sending-network/sdn-php-sdk library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sending-network / sdn-php-sdk example snippets
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();
// create new room
$client->createRoom("room name");
// invite user
$client->getRoom($roomId)->inviteUser($userId);
// send message
$client->getRoom($roomId)->sendText("hello");
composer