PHPackages                             trifs/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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. trifs/jsonrpc

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

trifs/jsonrpc
=============

A simple JSON-RPC client and server

v1.1.1(8y ago)220.7k4[1 issues](https://github.com/3fs/php-json-rpc/issues)MITPHPPHP &gt;=5.5CI failing

Since Jul 4Pushed 8y ago3 watchersCompare

[ Source](https://github.com/3fs/php-json-rpc)[ Packagist](https://packagist.org/packages/trifs/jsonrpc)[ Docs](https://github.com/3fs/php-json-rpc)[ RSS](/packages/trifs-jsonrpc/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependencies (4)Versions (4)Used By (0)

PHP JSON-RPC
============

[](#php-json-rpc)

PHP JSON-RPC is a simple JSON-RPC client and server. It is currently in an alpha state, a stable version is expected soon. Word of warning, API will probably change soon as well :)

[![Build Status](https://camo.githubusercontent.com/9467f4932e19729269916069ff8ae31501e555643676e536d5ddae3e456ae5aa/68747470733a2f2f7472617669732d63692e6f72672f3366732f7068702d6a736f6e2d7270632e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/3fs/php-json-rpc)

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

[](#installation)

### Composer

[](#composer)

Simply add a dependency on `trifs/phpjsonrpc` to your project's `composer.json` file if you use [Composer](http://getcomposer.org/) to manage the dependencies of your project. Here is a minimal example of a `composer.json`:

```
{
    "require": {
        "trifs/jsonrpc": "dev-master"
    }
}
```

For a system-wide installation via Composer, you can run:

```
composer global require 'trifs/phpjsonrpc=*'
```

Usage Examples
--------------

[](#usage-examples)

### Client (single request)

[](#client-single-request)

```
$client = new trifs\jsonrpc\Client('http://example.com');
$client->request('method-one')
    ->send();

$client = new trifs\jsonrpc\Client('http://example.com');
$client->notification('method-one')
    ->send();
```

### Client (batch request)

[](#client-batch-request)

```
$client = new trifs\jsonrpc\Client('http://example.com');
$client->request('method-one')
    ->request('method-two')
    ->notification('method-three')
    ->send();
```

### Client configuration

[](#client-configuration)

Client can be configured with additional options:

- `timeout` in seconds, connection timeout for `file_get_contents` calls.

```
$client = new trifs\jsonrpc\Client(
    'http://example.com',
    ['timeout' => 5, ]
);
```

There is also the option of swapping `file_get_contents` call with an implementation that uses `curl`:

```
$client->setTransporter(new trifs\jsonrpc\Client\Transporter\CurlTransporter());
```

The option might be useful if php.ini configuration `allow_url_fopen` is set to `Off`, which disables `file_get_contents` for remote URLs.

### Server

[](#server)

```
$input   = file_get_contents('php://input');
$invoker = function($method, array $params = []) {
    return time();
};

$server = new trifs\jsonrpc\Server($input, $invoker);
$server->run();
```

Contributing
------------

[](#contributing)

Contributions are always welcome. You make our lives easier by sending us your contributions through GitHub pull requests.

Due to time constraints, we are not always able to respond as quickly as we would like. Please do not take delays personal and feel free to remind us here if you feel that we forgot to respond.

### Using PHP JSON-RPC in a development environment

[](#using-php-json-rpc-in-a-development-environment)

To set PHP JSON-RPC up locally, make sure to have [Vagrant](http://vagrantup.com) and [VirtualBox](http://virtualbox.org) installed.

```
git clone git://github.com/3fs/php-json-rpc
cd php-json-rpc
vagrant up
```

After making the changes, run `./build/qa.sh all`, sit back and relax. If there are problems reported, repeat. If not, try harder :)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 82.4% 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 ~600 days

Total

3

Last Release

3133d ago

### Community

Maintainers

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

---

Top Contributors

[![davidkuridza](https://avatars.githubusercontent.com/u/953796?v=4)](https://github.com/davidkuridza "davidkuridza (14 commits)")[![thejan2009](https://avatars.githubusercontent.com/u/1621134?v=4)](https://github.com/thejan2009 "thejan2009 (3 commits)")

---

Tags

jsonclientrpcserverjsonrpc

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[datto/json-rpc-http

HTTP client and server for JSON-RPC 2.0

66525.9k5](/packages/datto-json-rpc-http)[thiagof/laravelrpc

JsonRPC Client/Server services for Laravel 5

337.5k](/packages/thiagof-laravelrpc)

PHPackages © 2026

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