nizsheanez / yii2-json-rpc
A lightweight JsonRpc Server and Client for PHP
Installs: 29 763
Dependents: 0
Suggesters: 0
Security: 0
Stars: 18
Watchers: 4
Forks: 20
Open Issues: 1
Type:yii2-extension
Requires
- php: >=5.4.0
- yiisoft/yii2: *
README
JsonRpc Server and Client for Yii2
##Usage Server
- Install with Composer
"require": { "nizsheanez/yii2-json-rpc": "1.*", }, php composer.phar update
- Add action to controller
public function actions() { return array( 'index' => array( 'class' => \nizsheanez\jsonRpc\Action::class, ), ); } public function sum($a, $b) { return $a + $b; }
- 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;
- Enjoy!