PHP code example of severalnines / rpcphp

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

    

severalnines / rpcphp example snippets



 = \Severalnines\Rpc::init(
    array(
        0 => 'wZPkJaOccOEYCVxr',
        1 => 'cRiuu4YfhET4SLuo'
    ),
    '127.0.0.1'
);

$hostsResponse = $rpc
    ->cluster(1)
    ->stat()
    ->getHosts();

if (!$hostsResponse->ok()) {
    die($hostsResponse->getError());
}

var_dump($hostsResponse->getData());