PHPackages                             moaction/jsonrpc-common - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. moaction/jsonrpc-common

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

moaction/jsonrpc-common
=======================

Jsonrpc common libraries

v1.5(12y ago)027312MITPHPPHP &gt;=5.3.3

Since Dec 4Pushed 12y ago1 watchersCompare

[ Source](https://github.com/moaction/jsonrpc-common)[ Packagist](https://packagist.org/packages/moaction/jsonrpc-common)[ RSS](/packages/moaction-jsonrpc-common/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (7)Used By (2)

Jsonrpc-common
==============

[](#jsonrpc-common)

Common libraries for JSON-Rpc 2.0 protocol implementation

Libraries are used in jsonrpc-client and jsonrpc-server

Request
-------

[](#request)

class `\Moaction\Jsonrpc\Common\Request`

### Fields (getters and setters for fields):

[](#fields-getters-and-setters-for-fields)

- *method*
- *id*
- *params*

### Methods

[](#methods)

- *toArray()*

```
$request = new \Moaction\Jsonrpc\Common\Request
$request->setId(1);
$request->setMethod('getUserData');
$request->setParams(array('userId' => 4, 'field' => 'email'));
// here you get valid jsonrpc 2.0 request object ready for json_encode
// \InvalidArgumentException can be thrown when Request object is misconfigured (method is not set).
$data = $request->toArray();
```

Response
--------

[](#response)

class `\Moaction\Jsonrpc\Common\Response`

### Fields (getters and setters for fields):

[](#fields-getters-and-setters-for-fields-1)

- *result*
- *error*
- *id*

### Methods

[](#methods-1)

- *fromArray()*
- *hasError()*

### Normal response

[](#normal-response)

```
// decoded array with jsonrpc 2.0 response
$data = array(
    'id'     => 1,
    'result' => array(
        'email' => 'user@example.com',
    ),
);
// \Moaction\Jsonrpc\Common\Exception can be thrown when object is not valid jsonrpc response
$response = new \Moaction\Jsonrpc\Common\Response::fromArray($data);
```

### Error response

[](#error-response)

```
// decoded array with jsonrpc 2.0 response
$data = array(
    'id'     => 1,
    'error' => array(
        'code' => '20',
        'message' => 'User not found',
        'data' => array('userId' => 4),
    ),
);
$response = new \Moaction\Jsonrpc\Common\Response::fromArray($data);
// \Moaction\Jsonrpc\Common\Error object
$error = $response->getError();
```

Error
-----

[](#error)

class `\Moaction\Jsonrpc\Common\Error`

Error object. See response for example.

Exception
---------

[](#exception)

class `\Moaction\Jsonrpc\Common\Exception`

Exception for using in jsonrpc libraries

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

6

Last Release

4531d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d7c16a24b8122bf5ae525c5fed74175e6b45fa6683cfc34cb9d7cd1ae295d390?d=identicon)[nitso](/maintainers/nitso)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/moaction-jsonrpc-common/health.svg)

```
[![Health](https://phpackages.com/badges/moaction-jsonrpc-common/health.svg)](https://phpackages.com/packages/moaction-jsonrpc-common)
```

###  Alternatives

[albertcht/lumen-helpers

To support Laravel 's unsupported features in Lumen.

2931.3k1](/packages/albertcht-lumen-helpers)[juststeveking/laravel-stubs

An opinionated version of the Laravel stubs

111.1k](/packages/juststeveking-laravel-stubs)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
