https://github.com/datto/php-json-rpc-simple
Request-to-class mapping extension for the JSON-RPC library
https://github.com/datto/php-json-rpc-simple
Last synced: about 1 year ago
JSON representation
Request-to-class mapping extension for the JSON-RPC library
- Host: GitHub
- URL: https://github.com/datto/php-json-rpc-simple
- Owner: datto
- License: lgpl-3.0
- Created: 2015-12-14T13:12:02.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-06T16:17:44.000Z (about 10 years ago)
- Last Synced: 2025-03-27T18:21:25.349Z (about 1 year ago)
- Language: PHP
- Size: 14.6 KB
- Stars: 4
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# JSON-RPC Simple Mapper
This is a request-to-class mapping extension for the [php-json-rpc](https://github.com/datto/php-json-rpc) library. Its purpose is to eliminate the need to write manual mapping functions for API endpoints by providing an automatic mapping of the JSON-RPC `method` and `params` arguments to a matching PHP class, method and parameters.
Examples
--------
First write an API end point:
```php
reply('{"jsonrpc": "2.0", "method": "math/subtract", "params": {"a": 3, "b": 2}, "id": 1}');
```
Or to use a custom root namespace (here: `Datto\NodeAPI`):
```php
$server = new Server(new Simple\Evaluator(new Simple\Mapper('Datto\\NodeAPI')));
echo $server->reply('...');
```
Requirements
------------
* PHP >= 5.3
Installation
------------
```javascript
"require": {
"datto/json-rpc-simple": "~4.0"
}
```
License
-------
This package is released under an open-source license: [LGPL-3.0](https://www.gnu.org/licenses/lgpl-3.0.html).
Author
------
Written by [Philipp C. Heckel](https://github.com/binwiederhier).