PHP code example of cloudws / cloudws-php-api

1. Go to this page and download the library: Download cloudws/cloudws-php-api 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/ */

    

cloudws / cloudws-php-api example snippets



ent = new CloudWS\Client($_SERVER['CLOUDWS_TOKEN']);


$client->createChannel('channel');


$client->getAllChannels();


$client->sendMessage('channel', ['data' => 'my_message']);


$client->deleteChannel('channel');



nt = new CloudWS\Client($_SERVER['CLOUDWS_TOKEN']);

try {
    $client->sendMessage('channel', ['data' => 'my_message']);
} catch (\CloudWS\CloudWSException $e) {
    $client->createChannel('channel');
}
print_r($client->getAllChannels());
$client->deleteChannel('channel');

composer