PHPackages                             yocto/yoclib-jsonrpc - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. yocto/yoclib-jsonrpc

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

yocto/yoclib-jsonrpc
====================

This yocLibrary enables your project to encode and decode JSON-RPC messages in PHP.

v1.0.1(1y ago)06GPL-3.0-or-laterPHPPHP ^7.4||^8

Since May 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/yocto/yoclib-jsonrpc-php)[ Packagist](https://packagist.org/packages/yocto/yoclib-jsonrpc)[ RSS](/packages/yocto-yoclib-jsonrpc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

yocLib - JSON-RPC (PHP)
=======================

[](#yoclib---json-rpc-php)

This yocLibrary enables your project to encode and decode JSON-RPC messages in PHP.

Status
------

[](#status)

[![PHP Composer](https://github.com/yocto/yoclib-jsonrpc-php/actions/workflows/php.yml/badge.svg)](https://github.com/yocto/yoclib-jsonrpc-php/actions/workflows/php.yml)[![codecov](https://camo.githubusercontent.com/1420f653b162bc3a84349c0bbd61f7c4db8484991991f0364829e7e1432cf8df/68747470733a2f2f636f6465636f762e696f2f67682f796f63746f2f796f636c69622d6a736f6e7270632d7068702f67726170682f62616467652e7376673f746f6b656e3d43564a4a47545a4a3158)](https://codecov.io/gh/yocto/yoclib-jsonrpc-php)

Installation
------------

[](#installation)

`composer require yocto/yoclib-jsonrpc`

Use
---

[](#use)

### Serialization

[](#serialization)

```
use YOCLIB\JSONRPC\JSONRPCException;
use YOCLIB\JSONRPC\Message;

// Create request
$message = Message::createRequest(123,'getInfo',['payments']);
// Create notification
$message = Message::createNotification('notificationEvent',['payed']);
// Create response
$message = Message::createResponse(123,['payments'=>['$10.12','$23.45','$12.34']]);

$object = $message->toObject();

try{
    $json = Message::encodeJSON($object);
}catch(JSONRPCException $e){
    //Handle encoding exception
}
```

### Deserialization

[](#deserialization)

```
use YOCLIB\JSONRPC\JSONRPCException;
use YOCLIB\JSONRPC\Message;

$json = file_get_contents('php://input'); // Get request body

try{
    $object = Message::decodeJSON($json);
}catch(JSONRPCException $e){
    //Handle decoding exception
}

if(Message::isBatch($object)){
    foreach($object AS $element){
        try{
            $message = Message::parse($element);
        }catch(JSONRPCException $e){
            //Handle message exception
        }
    }
}else{
    try{
        $message = Message::parse($object);
    }catch(JSONRPCException $e){
        //Handle message exception
    }
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~3 days

Total

2

Last Release

721d ago

### Community

Maintainers

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

---

Top Contributors

[![ben221199](https://avatars.githubusercontent.com/u/12856904?v=4)](https://github.com/ben221199 "ben221199 (26 commits)")

---

Tags

phpjsoncomposerrpcjsonrpcjson-rpcyoctoyoclib

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yocto-yoclib-jsonrpc/health.svg)

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

###  Alternatives

[datto/json-rpc

Fully unit-tested JSON-RPC 2.0 for PHP

1951.3M14](/packages/datto-json-rpc)[datto/json-rpc-http

HTTP client and server for JSON-RPC 2.0

66525.9k5](/packages/datto-json-rpc-http)[wa72/jsonrpc-bundle

JSON-RPC server for Symfony: exposes services registered in the service container as JSON-RPC webservices

3164.1k](/packages/wa72-jsonrpc-bundle)[cranetm/yii2-json-rpc-2.0

JSON RPC 2.0 for Yii2 strict type validation of request and response data

2679.6k1](/packages/cranetm-yii2-json-rpc-20)[nizsheanez/yii2-json-rpc

A lightweight JsonRpc Server and Client for PHP

2034.0k](/packages/nizsheanez-yii2-json-rpc)

PHPackages © 2026

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