PHP code example of stealth / jsonrpc-client
1. Go to this page and download the library: Download stealth/jsonrpc-client 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/ */
stealth / jsonrpc-client example snippets
'providers' => [
//...
Tochka\JsonRpcClient\ServiceProvider::class,
],
$app->configure('jsonrpc');
$app->withFacades();
$app->register(Tochka\JsonRpcClient\ServiceProvider::class);
use Tochka\JsonRpcClient\Client;
//....
$result = Client::fooBar('Some text');
$result = Client::get('api')->fooBar('Some text');
$result = Client::get('api')->call('fooBar', ['text' => 'Some text']);
$api = Client::get('api')->batch();
$resultFoo = $api->foo('params');
$resultBar = $api->bar(123);
$resultSome = $api->call('someMethod', ['param1' => 1, 'param2' => true]);
$api->execute();
$result = Client::get('api')->cache(10)->fooBar('Some text');
$api = Client::get('api')->batch();
$resultFoo = $api->cache(10)->foo('params');
$resultBar = $api->bar(123);
$resultSome = $api->cache(60)->call('someMethod', ['param1' => 1, 'param2' => true]);
$api->execute();
// Single call
$result = Api::fooBar('Some text');
// Multiple call
$api = Api::batch();
$resultFoo = $api->cache(10)->foo('params');
$resultBar = $api->bar(123);
$resultSome = $api->cache(60)->someMethod(1, true);
$api->execute();
php artisan vendor:publish --provider="Tochka\JsonRpcClient\ServiceProvider"
php artisan jsonrpc:generateClient connection
php artisan jsonrpc:generateClient