PHP code example of funnyfig / swoole_jsonrpc

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

    

funnyfig / swoole_jsonrpc example snippets



$client = new JsonRpc\Client($url);
$client->call('method', array($param1, $param2));

// now do something with $client->result


// MethodsClass contains the exposed methods
$methods = new MethodsClass();

$server = new JsonRpc\Server($methods);
$server->receive();