2017 © Pedro Peláez
 

library advanced-json-rpc

A more advanced JSONRPC implementation

image

felixfbecker/advanced-json-rpc

A more advanced JSONRPC implementation

  • Monday, February 19, 2018
  • by felixfbecker
  • Repository
  • 1 Watchers
  • 4 Stars
  • 114,566 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 1 Forks
  • 13 Open issues
  • 28 Versions
  • 45 % Grown

The README.md

Advanced JSONRPC

Version Build Status Coverage semantic-release License, (*1)

Provides basic classes for requests and responses in JSONRPC and a Dispatcher class that can decode a JSONRPC request and call appropriate methods on a target, coercing types of parameters by type-hints and @param tags., (*2)

Supports nested targets: If the method is something like myNestedTarget->theMethod, the dispatcher will look for a myNestedTarget property on the target and call theMethod on it. The delimiter is configurable and defaults to the PHP object operator ->., (*3)

Example

use AdvancedJsonRpc\Dispatcher;

class Argument 
{
    public $aProperty;
}

class Target
{
    public function someMethod(Argument $arg)
    {
        // $arg instanceof Argument === true
        // $arg->aProperty === 123
        return 'Hello World';
    }
}

$dispatcher = new Dispatcher(new Target());

$result = $dispatcher->dispatch('
    {
        "jsonrpc": "2.0",
        "id": 1,
        "method": "someMethod", 
        "params": {
            "arg": {"aProperty": 123}
        }
    }
');

// $result === "Hello World"

Nested Targets

use AdvancedJsonRpc\Dispatcher;

class TextDocumentManager 
{
    public function didOpen(string $uri)
    {
        return 'Thank you for this information';
    }
}

class LanguageServer
{
    public $textDocument;

    public function __construct()
    {
        $this->textDocument = new TextDocumentManager();
    }
}

$dispatcher = new Dispatcher(new LanguageServer(), '/');

$result = $dispatcher->dispatch('
    {
        "jsonrpc": "2.0",
        "id": 1,
        "method": "textDocument/didOpen", 
        "params": {
            "uri": "file:///c/Users/felix/test.php"
        }
    }
');

// $result === "Thank you for this information"

The Versions

19/02 2018

dev-semantic-release-15.0.0-126.1.0

dev-semantic-release-15.0.0-126.1.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

14/02 2018

dev-semantic-release-14.0.0-121.1.0

dev-semantic-release-14.0.0-121.1.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

28/01 2018

dev-semantic-release-13.0.0-104.1.0

dev-semantic-release-13.0.0-104.1.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

31/12 2017

dev-semantic-release-12.0.0-78.1.0

dev-semantic-release-12.0.0-78.1.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

28/11 2017

dev-master

9999999-dev

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

25/11 2017

dev-semantic-release-11.0.0-40.1.0

dev-semantic-release-11.0.0-40.1.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

25/11 2017

dev-@semantic-release/last-release-git-tag-2.0.0-40.1.0

dev-@semantic-release/last-release-git-tag-2.0.0-40.1.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

22/11 2017

dev-semantic-release-10

dev-semantic-release-10

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

28/10 2017

v3.0.1

3.0.1.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

23/10 2017

dev-phpdocumentor/reflection-docblock-4.0.0-#2.0.0

dev-phpdocumentor/reflection-docblock-4.0.0-#2.0.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

23/10 2017

v3.0.0

3.0.0.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

22/06 2017

v2.0.3

2.0.3.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

22/06 2017

v2.0.2

2.0.2.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

20/10 2016

v2.0.1

2.0.1.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

20/10 2016

v2.0.0

2.0.0.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

04/09 2016

v1.2.10

1.2.10.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

02/09 2016

v1.2.9

1.2.9.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

02/09 2016

v1.2.8

1.2.8.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

02/09 2016

v1.2.7

1.2.7.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

25/08 2016

v1.2.6

1.2.6.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

25/08 2016

v1.2.5

1.2.5.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

25/08 2016

v1.2.4

1.2.4.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

25/08 2016

v1.2.3

1.2.3.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

25/08 2016

v1.2.2

1.2.2.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

25/08 2016

v1.2.1

1.2.1.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

25/08 2016

v1.2.0

1.2.0.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

25/08 2016

v1.1.0

1.1.0.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker

24/08 2016

v1.0.0

1.0.0.0

A more advanced JSONRPC implementation

  Sources   Download

ISC

The Requires

 

The Development Requires

by Felix Becker