Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/raoptimus/yii2-jsonrpc2
Json RPC client 1.0 and 2.0 versions for Yii2
https://github.com/raoptimus/yii2-jsonrpc2
json-rpc-client json-rpc2-client jsonrpc jsonrpc2 php yii2 yii2-extension yii2-jsonrpc yii2-jsonrpc2
Last synced: 2 months ago
JSON representation
Json RPC client 1.0 and 2.0 versions for Yii2
- Host: GitHub
- URL: https://github.com/raoptimus/yii2-jsonrpc2
- Owner: raoptimus
- License: bsd-3-clause
- Created: 2018-10-05T05:18:24.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-13T14:42:14.000Z (about 6 years ago)
- Last Synced: 2024-10-01T14:25:29.960Z (3 months ago)
- Topics: json-rpc-client, json-rpc2-client, jsonrpc, jsonrpc2, php, yii2, yii2-extension, yii2-jsonrpc, yii2-jsonrpc2
- Language: PHP
- Homepage:
- Size: 30.3 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[![Stable Version](https://poser.pugx.org/raoptimus/yii2-jsonrpc2/v/stable)](https://packagist.org/packages/raoptimus/yii2-jsonrpc2)
[![Untable Version](https://poser.pugx.org/raoptimus/yii2-jsonrpc2/v/unstable)](https://packagist.org/packages/raoptimus/yii2-jsonrpc2)
[![License](https://poser.pugx.org/raoptimus/yii2-jsonrpc2/license)](https://packagist.org/packages/raoptimus/yii2-jsonrpc2)
[![Total Downloads](https://poser.pugx.org/raoptimus/yii2-jsonrpc2/downloads)](https://packagist.org/packages/raoptimus/yii2-jsonrpc2)
[![Build Status](https://travis-ci.com/raoptimus/yii2-jsonrpc2.svg?branch=master)](https://travis-ci.com/raoptimus/yii2-jsonrpc2)# yii2-jsonrpc2
Json RPC client 1.0 and 2.0 versions for Yii2## Installation
Install with composer:
```bash
composer require raoptimus/yii2-jsonrpc2
```## Usage samples
Configuration
```php
return [
//....
'components' =>
'jsonrpc' => [
'class' => raoptimus\jsonrpc2\Connection::class,
'hostname' => 'localhost',
'port' => 8666,
],
];
``````php
return [
//....
'components' =>
'jsonrpc' => [
'class' => raoptimus\jsonrpc2\Connection::class,
'unixSocket' => '/tmp/jsonrpc2.sock',
'spec' => raoptimus\jsonrpc2\Connection::SPEC_2_0,
],
];
```Use connection
```php
$rpc = \Yii::$app->get('jsonrpc');
$method = "SomeMethodName";
$param = "SomeEnterParam";
$request = $rpc->createRequest($method, [$param]);
$rpc->sendRequest($request);
$result = $rpc->readResponse()->result;
//or
$result = $rpc->$method($param);
```