PHP code example of gudaojuanma / airfone

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

    

gudaojuanma / airfone example snippets


use Airfone\Airfone;

$identify = '1234567890123456';

$secret = '12345678901234567890123456789012';

$ws = 'ws://airfone.online';

$host = 'airfone.online';

$port = 9331;

$airfone = new Airfone($identify, $secret, $ws, $host, $port);

$message = [
    'type' => 'server:monitor:tick',
    'cpu' => 1500,
    'cpus' => [1000, 1200, 1800, 2000]
];

$airfone->publish('channel', $message);

$airfone->broadcast($message);