nizsheanez/yii2-json-rpc A lightweight JsonRpc Server and Client for PHP

jsonrpcjsonrpc

JsonRpc Server and Client for Yii2

Usage Server

1) Install with Composer

"require": {
    "nizsheanez/yii2-json-rpc": "1.*",
},

php composer.phar update

2) Add action to controller

public function actions()
{
    return array(
        'index' => array(
            'class' => \nizsheanez\jsonRpc\Action::class,
        ),
    );
}

public function sum($a, $b) {
    return $a + $b;
}

3) All methods of controller now available as JsonRpc methods, for example see method sum:

Usage Client

$client = new \nizsheanez\JsonRpc\Client('http://url/of/webservice');

$response = $client->sum(2, 3);
echo $response;

4) Enjoy!

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



v1.1.8 is the latest of 13 releases



BSD-3-Clause license
Stats
18 github stars & 20 github forks
12 downloads in the last day
323 downloads in the last 30 days
26292 total downloads