https://github.com/datto/php-json-rpc-ssh
SSH client and server for JSON-RPC 2.0
https://github.com/datto/php-json-rpc-ssh
Last synced: about 1 year ago
JSON representation
SSH client and server for JSON-RPC 2.0
- Host: GitHub
- URL: https://github.com/datto/php-json-rpc-ssh
- Owner: datto
- License: lgpl-3.0
- Created: 2015-05-22T19:58:29.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-06-26T19:22:20.000Z (almost 11 years ago)
- Last Synced: 2025-03-27T18:21:24.297Z (about 1 year ago)
- Language: PHP
- Size: 137 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# JSON-RPC for PHP
## Features
* Fully compliant with the [JSON-RPC 2.0 specifications](http://www.jsonrpc.org/specification) (with 100% unit-test coverage)
* Flexible: you can choose your own system for interpreting the JSON-RPC method strings
* Minimalistic (just two tiny files)
* Ready to use, with working examples
## Requirements
* PHP >= 5.3
## License
This package is released under an open-source license: [LGPL-3.0](https://www.gnu.org/licenses/lgpl-3.0.html)
## Examples
### Client
```php
$client = new Client($destination, $command, $options);
$client->query(1, 'add', array(1, 2));
$reply = $client->send(); // array('jsonrpc' => '2.0', 'id' => 1, 'result' => 3)
```
### Server
```php
$translator = new Translator();
$server = new Server($translator);
$server->reply();
```
*See the "examples" folder for ready-to-use examples.*
## Installation
If you're using [Composer](https://getcomposer.org/), you can use this package
([datto/json-rpc-ssh](https://packagist.org/packages/datto/json-rpc-ssh))
by inserting a line into the "require" section of your "composer.json" file:
```
"datto/json-rpc-ssh": "~1.0"
```
## Getting started
1. Try the examples! Follow the README file in the "examples" directory to
set up an SSH environment. Then run the examples from the project directory
like this:
```
php examples/client.php
```
2. Once your example is working, replace the
[example "Server" code](https://github.com/datto/php-json-rpc-ssh/tree/master/examples/Server)
with your own code.
3. Write a beautiful wrapper around the JSON-RPC client class that will dovetail
with your project.
## Author
[Spencer Mortensen](http://spencermortensen.com/contact/)