PHPackages                             yoanm/symfony-jsonrpc-http-server - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. yoanm/symfony-jsonrpc-http-server

ActiveSymfony-bundle[HTTP &amp; Networking](/categories/http)

yoanm/symfony-jsonrpc-http-server
=================================

Symfony Bundle to convert an HTTP json-rpc request into HTTP json-rpc response

v4.0.2(8mo ago)12179.6k↓15.6%14[3 issues](https://github.com/yoanm/symfony-jsonrpc-http-server/issues)[5 PRs](https://github.com/yoanm/symfony-jsonrpc-http-server/pulls)3MITPHPPHP ^8.0CI failing

Since Apr 7Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/yoanm/symfony-jsonrpc-http-server)[ Packagist](https://packagist.org/packages/yoanm/symfony-jsonrpc-http-server)[ RSS](/packages/yoanm-symfony-jsonrpc-http-server/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (20)Versions (31)Used By (3)

Symfony JSON-RPC server
=======================

[](#symfony-json-rpc-server)

[![License](https://camo.githubusercontent.com/8cba361074e1436db725e253473e1812178a37b84a514928c56ff25471491bf2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f796f616e6d2f73796d666f6e792d6a736f6e7270632d687474702d7365727665722e737667)](https://github.com/yoanm/symfony-jsonrpc-http-server)[![Code size](https://camo.githubusercontent.com/25060bbd46c3c5bc4a3d2e08bfdf2a8d3af247befb9278f0ce33f9bb1ab85642/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f796f616e6d2f73796d666f6e792d6a736f6e7270632d687474702d7365727665722e737667)](https://github.com/yoanm/symfony-jsonrpc-http-server)[![Dependabot Status](https://camo.githubusercontent.com/5195a5411fd5bfdc2f9f4ec317da6ed6a2df2b405e33428011c47eaf59606445/68747470733a2f2f666c61742e62616467656e2e6e65742f6769746875622f646570656e6461626f742f796f616e6d2f73796d666f6e792d6a736f6e7270632d687474702d736572766572)](https://camo.githubusercontent.com/5195a5411fd5bfdc2f9f4ec317da6ed6a2df2b405e33428011c47eaf59606445/68747470733a2f2f666c61742e62616467656e2e6e65742f6769746875622f646570656e6461626f742f796f616e6d2f73796d666f6e792d6a736f6e7270632d687474702d736572766572)[![Last commit](https://camo.githubusercontent.com/7f03484573c69c5a0cd8205e43d41a825fa7e9b4cc20bbb45a54b7d9a26cec94/68747470733a2f2f62616467656e2e6e65742f6769746875622f6c6173742d636f6d6d69742f796f616e6d2f73796d666f6e792d6a736f6e7270632d687474702d736572766572)](https://camo.githubusercontent.com/7f03484573c69c5a0cd8205e43d41a825fa7e9b4cc20bbb45a54b7d9a26cec94/68747470733a2f2f62616467656e2e6e65742f6769746875622f6c6173742d636f6d6d69742f796f616e6d2f73796d666f6e792d6a736f6e7270632d687474702d736572766572)

[![Scrutinizer Build Status](https://camo.githubusercontent.com/9d3c01fef1d4d26302bd3677522577c1fcfecf9b5424bdbdadfccbb7783448e0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f6275696c642f672f796f616e6d2f73796d666f6e792d6a736f6e7270632d687474702d7365727665722e7376673f6c6162656c3d5363727574696e697a6572266c6f676f3d7363727574696e697a6572)](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d1e624b2a3a9d7992b5e9020745839d6d905c63c25bd551c902699c542d82445/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f796f616e6d2f73796d666f6e792d6a736f6e7270632d687474702d7365727665722f6d61737465722e7376673f6c6f676f3d7363727574696e697a6572)](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server/?branch=master)[![Codacy Badge](https://camo.githubusercontent.com/9fb44e29c9d4bd4ecd206541fbd305938a5a0dbcc15fdab5d1db97a7a24ce23a/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3866333934323461646430343462343361373062646232333865326634386462)](https://www.codacy.com/gh/yoanm/symfony-jsonrpc-http-server/dashboard?utm_source=github.com&utm_medium=referral&utm_content=yoanm/symfony-jsonrpc-http-server&utm_campaign=Badge_Grade)

[![CI](https://github.com/yoanm/symfony-jsonrpc-http-server/actions/workflows/CI.yml/badge.svg?branch=master)](https://github.com/yoanm/symfony-jsonrpc-http-server/actions/workflows/CI.yml)[![codecov](https://camo.githubusercontent.com/4eb8c10ae48b288957a65ab1f4c862689229386731ab722e1455bad10aa9b958/68747470733a2f2f636f6465636f762e696f2f67682f796f616e6d2f73796d666f6e792d6a736f6e7270632d687474702d7365727665722f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d4e486477454255464b35)](https://codecov.io/gh/yoanm/symfony-jsonrpc-http-server)[![Symfony Versions](https://camo.githubusercontent.com/a0f96454a73e2467cd8e9274759de603045720eb9f2e4770b01951d648720bc4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d76352e3425323025324625323076362e3425323025324625323076372e782d3838393242462e7376673f6c6f676f3d676974687562)](https://symfony.com/)

[![Latest Stable Version](https://camo.githubusercontent.com/58d8dd564b39b147bcdaec94365c14b2e077d77e2473a4de6b90cab5592b3c47/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f796f616e6d2f73796d666f6e792d6a736f6e7270632d687474702d7365727665722e737667)](https://packagist.org/packages/yoanm/symfony-jsonrpc-http-server)[![Packagist PHP version](https://camo.githubusercontent.com/13ee304ba3303247eb85b6a696a661fede1d96ae1434e0c8f8fbc8e6e14437f9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f796f616e6d2f73796d666f6e792d6a736f6e7270632d687474702d7365727665722e737667)](https://packagist.org/packages/yoanm/symfony-jsonrpc-http-server)

Symfony JSON-RPC HTTP Server to convert an HTTP json-rpc request into HTTP json-rpc response.

Symfony bundle for [`yoanm/jsonrpc-server-sdk`](https://github.com/yoanm/php-jsonrpc-server-sdk)

See [yoanm/symfony-jsonrpc-params-validator](https://github.com/yoanm/symfony-jsonrpc-params-validator) for params validation.

See [yoanm/symfony-jsonrpc-http-server-doc](https://github.com/yoanm/symfony-jsonrpc-http-server-doc) for documentation generation.

Versions
--------

[](#versions)

- Symfony v3/4 - PHP &gt;=7.1 : `^2.0`

    ⚠️⚠️ `v2.1.0` and `v2.1.1` were badly taggued, used `v3.0.0` instead ! ⚠️⚠️
- Symfony v4/5 - PHP &gt;=7.2 : `~3.0.0`
- Symfony v4/5 - PHP &gt;=7.3 : `^3.1`
- Symfony v4.4/5.4 - PHP ^8.0 : `^3.2`
- Symfony v4.4/5.4/6.x - PHP ^8.0 : `^3.3`
- Symfony v5.4/6.4/7.x - PHP ^8.0 : `^4.0`

How to use
----------

[](#how-to-use)

Once configured, your project is ready to handle HTTP `POST` request on `/json-rpc` endpoint.

See below how to configure it.

Configuration
-------------

[](#configuration)

Bundle requires only one thing :

- JSON-RPC Methods which are compatible with [`yoanm/jsonrpc-server-sdk`](https://raw.githubusercontent.com/yoanm/php-jsonrpc-server-sdk)

It comes with [built-in method resolver](./src/Resolver/MethodResolver.php) which use a [service locator](https://symfony.com/doc/3.4/service_container/service_subscribers_locators.html#defining-a-service-locator). Using a service locator allow to load (and so instanciate dependencies, dependencies of dependencies, etc) method only when required (usually only one method is required by request, except for batch requests which will load one or more methods).

*[Behat demo app configuration folders](./features/demo_app/) can be used as examples.*

- Add the bundles in your `config/bundles.php` file:

    ```
    // config/bundles.php
    return [
        ...
        Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
        Yoanm\SymfonyJsonRpcHttpServer\JsonRpcHttpServerBundle::class => ['all' => true],
        ...
    ];
    ```
- Add the following in your routing configuration :

    ```
    # config/routes.yaml
    json-rpc-endpoint:
      resource: '@JsonRpcHttpServerBundle/Resources/config/routing/endpoint.xml'
    ```
- Add the following in your configuration :

    ```
    # config/config.yaml
    framework:
      secret: '%env(APP_SECRET)%'

    json_rpc_http_server: ~
    # Or the following in case you want to customize endpoint path
    #json_rpc_http_server:
    #  endpoint: '/my-custom-endpoint' # Default to '/json-rpc'
    ```

### JSON-RPC Method mapping

[](#json-rpc-method-mapping)

In order to inject yours JSON-RPC method into the server add the tag `json_rpc_http_server.jsonrpc_method` and the key/value `method` like following example :

```
services:
   method-a.service-id:
      class: Method\A\Class
      tags:
       - { name: 'json_rpc_http_server.jsonrpc_method', method: 'method-a' }
       - { name: 'json_rpc_http_server.jsonrpc_method', method: 'method-a-alias' }
```

### Methods mapping aware

[](#methods-mapping-aware)

In case you want to be aware of which methods are registered inside the JSON-RPC server, you can use the `json_rpc_http_server.method_aware`. Your class must implements `JsonRpcMethodAwareInterface`.

```
use Yoanm\JsonRpcServer\Domain\JsonRpcMethodAwareInterface;
use Yoanm\JsonRpcServer\Domain\JsonRpcMethodInterface;

class MappingCollector implements JsonRpcMethodAwareInterface
{
  /** @var JsonRpcMethodInterface[] */
  private $mappingList = [];

  public function addJsonRpcMethod(string $methodName, JsonRpcMethodInterface $method): void
  {
    $this->mappingList[$methodName] = $method;
  }

  /**
   * @return JsonRpcMethodInterface[]
   */
  public function getMappingList() : array
  {
    return $this->mappingList;
  }
}
```

```
mapping_aware_service:
  class: App\Collector\MappingCollector
  tags: ['json_rpc_http_server.method_aware']
```

Debug mode
----------

[](#debug-mode)

You can setup 'debug' mode for the JSON-RPC server, which allows display of verbose error information within the response JSON body. This information contains actual exception class name, code, message and stack trace.

> Note: you should never enable 'debug' mode in 'production' environment, since it will expose vital internal information to the API consumer.

Configuration example:

```
# file 'config/packages/json_rpc.yaml'
json_rpc_http_server:
  endpoint: '/json-rpc'
  debug:
    enabled: false
    max_trace_size: 10
    show_trace_arguments: true
    simplify_trace_arguments: true

when@dev:
  json_rpc_http_server:
    debug:
      enabled: true

when@test:
  json_rpc_http_server:
    debug:
      enabled: true
```

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

[](#contributing)

See [contributing note](./CONTRIBUTING.md)

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance65

Regular maintenance activity

Popularity43

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 92% 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 ~108 days

Recently: every ~4 days

Total

26

Last Release

245d ago

Major Versions

v0.1.0 → v1.0.02018-04-07

v1.1.0 → v2.0.02019-04-19

v2.2.0 → v3.0.02020-03-27

v3.4.2 → v4.0.02025-09-03

PHP version history (5 changes)v0.1.0PHP &gt;7.0

v2.0.0PHP &gt;=7.1

v2.1.0PHP &gt;=7.2

v3.1.0PHP ^7.3 || ^8.0

v3.2.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4410697?v=4)[yoanm](/maintainers/yoanm)[@yoanm](https://github.com/yoanm)

---

Top Contributors

[![yoanm](https://avatars.githubusercontent.com/u/4410697?v=4)](https://github.com/yoanm "yoanm (103 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![klimov-paul](https://avatars.githubusercontent.com/u/1482054?v=4)](https://github.com/klimov-paul "klimov-paul (2 commits)")[![jurgenf](https://avatars.githubusercontent.com/u/111112?v=4)](https://github.com/jurgenf "jurgenf (1 commits)")[![RuslanKononov](https://avatars.githubusercontent.com/u/11559319?v=4)](https://github.com/RuslanKononov "RuslanKononov (1 commits)")[![tacman](https://avatars.githubusercontent.com/u/619585?v=4)](https://github.com/tacman "tacman (1 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")

---

Tags

json-rpcjsonrpc-server-sdkphpsymfony-bundle

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/yoanm-symfony-jsonrpc-http-server/health.svg)

```
[![Health](https://phpackages.com/badges/yoanm-symfony-jsonrpc-http-server/health.svg)](https://phpackages.com/packages/yoanm-symfony-jsonrpc-http-server)
```

###  Alternatives

[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M233](/packages/nelmio-api-doc-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M343](/packages/drupal-core-recommended)[shopware/storefront

Storefront for Shopware

684.2M148](/packages/shopware-storefront)

PHPackages © 2026

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