PHP code example of bug-dealer / tivoka

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

    

bug-dealer / tivoka example snippets



$connection = Tivoka\Client::connect('http://example.com/api')
$request = $connection->sendRequest('substract', array(51, 9));
print $request->result;// 42


$connection = Tivoka\Client::connect(array('host' => 'example.com', 'port' => 1234))
$request = $connection->sendRequest('substract', array(51, 9));
print $request->result;// 42


$connection = Tivoka\Client::connect('ws://example.com/api')
$request = $connection->sendRequest('substract', array(51, 9));
print $request->result;// 42


$methods = array(
    'substract' => function($params) {
        list($num1, $num2) = $params
        return $num1 - $num2;
    }
);
Tivoka\Server::provide($methods)->dispatch();
sh
$ php composer.phar install