sending-network / sdn-php-sdk
PHP SDK for interacting with Sending-Network
v0.2.0
2023-08-21 11:32 UTC
Requires
- php: >=7.4
- ext-json: *
- ext-readline: *
- guzzlehttp/guzzle: ^6.3|^7
- kornrunner/keccak: ^1.1
- rappasoft/laravel-helpers: ^1.0
- simplito/elliptic-php: ^1.0
Requires (Dev)
- phpunit/phpunit: >=5.4.3
Replaces
- sending-network/sdk-php-sdk: v0.2.0
This package is not auto-updated.
Last update: 2025-07-07 20:32:17 UTC
README
A PHP SDK for Sending-Network.
Installation
composer require sending-network/sdn-php-sdk
Usage
Prepare a configuration file
Provide server node url, wallet address, private key and developer key in file bot.creds.json:
{
"nodeUrl": "https://example.com",
"walletAddress": "<WALLET_ADDRESS>",
"privateKey": "<PRIVATE_KEY>",
"developerKey": "<DEVELOPER_KEY>"
}
Create an instance of SDNClient
require('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
// create new room
$client->createRoom("room name");
// invite user
$client->getRoom($roomId)->inviteUser($userId);
// send message
$client->getRoom($roomId)->sendText("hello");
Examples
See more use cases in examples
directory.