PHPackages                             jalallinux/php-json-rpc-client - 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. [API Development](/categories/api)
4. /
5. jalallinux/php-json-rpc-client

ActiveLibrary[API Development](/categories/api)

jalallinux/php-json-rpc-client
==============================

This Package helps developers to easily connect to RPC servers.

1.1.0(3y ago)211[1 PRs](https://github.com/jalallinux/php-json-rpc-client/pulls)MITPHPPHP ^7.4|^8.0|^8.1|^8.2

Since Nov 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/jalallinux/php-json-rpc-client)[ Packagist](https://packagist.org/packages/jalallinux/php-json-rpc-client)[ Docs](https://github.com/jalallinux/php-json-rpc-client)[ Fund](https://reymit.ir/jalallinux)[ GitHub Sponsors](https://github.com/jalallinux)[ RSS](/packages/jalallinux-php-json-rpc-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (5)Used By (0)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f67d89dd4a890d97bb0310b7baa525c3626fad88c6be1877620330f4d92f40ae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a616c616c6c696e75782f7068702d6a736f6e2d7270632d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jalallinux/php-json-rpc-client)[![Tests](https://github.com/jalallinux/php-json-rpc-client/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/jalallinux/php-json-rpc-client/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/63b43bfafce9f41f3189ed9ba0bca618e485267185667fe1af748cce5863c673/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a616c616c6c696e75782f7068702d6a736f6e2d7270632d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jalallinux/php-json-rpc-client)

This Package helps developers to easily connect to RPC servers.

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

[](#installation)

You can install the package via composer:

```
composer require jalallinux/php-json-rpc-client
```

Usage
-----

[](#usage)

### Create instance:

[](#create-instance)

Supported options:

```
$rpc = new RpcClient('http://localhost:8000/rpc/server', '2.0');
```

### Defaults

[](#defaults)

- #### rpc version: `2.0`

    [](#rpc-version-20)
- #### options:

    [](#options)

```
{
    "http_errors": false,
    "headers": {
      "Content-Type": "application/json",
      "Accept": "application/json"
    }
}
```

### Set options:

[](#set-options)

```
$rpc->setOption('connect_timeout', 3.14);
```

### Set headers:

[](#set-headers)

```
$rpc->withHeaders(['api-key' => 'php-json-rpc-client-api-key']);
```

### Set BasicAuth credential:

[](#set-basicauth-credential)

```
$rpc->withBasicAuth(['username', 'password']);
```

### Set JWT authorization token:

[](#set-jwt-authorization-token)

```
$rpc->withJwtAuth('Bearer php-json-rpc-client-jwt-token');
```

### Add RPC request:

[](#add-rpc-request)

```
$rpc->request('user.get', ['username' => 'jalallinux']);
$rpc->request('user.get', ['username' => 'jalallinux'], '1');
```

### Add RPC notification:

[](#add-rpc-notification)

Description:

```
$rpc->notify('user.get', ['username' => 'jalallinux']);
```

### Send final requests:

[](#send-final-requests)

```
$rpc->send();
```

### Full Example:

[](#full-example)

```
$rpc = new RpcClient('http://localhost:8000/rpc/server', '2.0');

$response = $rpc->setOption('connect_timeout', 3.14);
                ->withHeaders(['api-key' => 'php-json-rpc-client-api-key']);
                ->withBasicAuth(['username', 'password']);
                ->withJwtAuth('Bearer php-json-rpc-client-jwt-token');
                ->request('user.get', ['username' => 'jalallinux']);
                ->request('user.get', ['username' => 'jalallinux'], '1');
                ->notify('user.get', ['username' => 'jalallinux']);
                ->send();
```

### Response Methods:

[](#response-methods)

```
$response->body(): string
$response->array(): array
$response->object(): object
$response->status(): int
$response->successful(): bool
$response->ok(): bool
$response->failed(): bool
$response->clientError(): bool
$response->serverError(): bool
$response->header(string $header): string
$response->headers(): array
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [JalalLinuX](https://github.com/jalallinux)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 65.8% 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 ~0 days

Total

3

Last Release

1262d ago

### Community

Maintainers

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

---

Top Contributors

[![jalallinux](https://avatars.githubusercontent.com/u/37062636?v=4)](https://github.com/jalallinux "jalallinux (25 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")

---

Tags

jalallinuxphp-json-rpc-client

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/jalallinux-php-json-rpc-client/health.svg)

```
[![Health](https://phpackages.com/badges/jalallinux-php-json-rpc-client/health.svg)](https://phpackages.com/packages/jalallinux-php-json-rpc-client)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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