2017 © Pedro Peláez
 

library json-rpc-simple

Request-to-class mapping extension for JSON-RPC library

image

datto/json-rpc-simple

Request-to-class mapping extension for JSON-RPC library

  • Wednesday, April 6, 2016
  • by binwiederhier
  • Repository
  • 4 Watchers
  • 3 Stars
  • 7,926 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 3 Versions
  • 6 % Grown

The README.md

JSON-RPC Simple Mapper

This is a request-to-class mapping extension for the 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., (*1)

Examples

First write an API end point:, (*2)

<?php

namespace Datto\API;

class Math
{
    public function subtract($a, $b)
    {
        return $a - $b;
    }
}

Then use the API (with the default namespace Datto\API):, (*3)

// This will instantiate an object of the type `Datto\API\Math`,
// call the `subtract` method, and return a corresponding JSON-RPC response.

$server = new Server(new Simple\Evaluator());
echo $server->reply('{"jsonrpc": "2.0", "method": "math/subtract", "params": {"a": 3, "b": 2}, "id": 1}');

Or to use a custom root namespace (here: Datto\NodeAPI):, (*4)

$server = new Server(new Simple\Evaluator(new Simple\Mapper('Datto\\NodeAPI')));
echo $server->reply('...');

Requirements

  • PHP >= 5.3

Installation

"require": {
  "datto/json-rpc-simple": "~4.0"
}

License

This package is released under an open-source license: LGPL-3.0., (*5)

Author

Written by Philipp C. Heckel., (*6)

The Versions

06/04 2016

dev-master

9999999-dev http://www.datto.com

Request-to-class mapping extension for JSON-RPC library

  Sources   Download

LGPL-3.0

The Requires

 

by Philipp Heckel

06/04 2016

4.0.1

4.0.1.0 http://www.datto.com

Request-to-class mapping extension for JSON-RPC library

  Sources   Download

LGPL-3.0

The Requires

 

by Philipp Heckel

15/12 2015

4.0.0

4.0.0.0 http://www.datto.com

Request-to-class mapping extension for JSON-RPC library

  Sources   Download

LGPL-3.0

The Requires

 

by Philipp Heckel