PHPackages                             tourze/json-rpc-http-direct-call-bundle - 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. tourze/json-rpc-http-direct-call-bundle

ActiveSymfony-bundle[API Development](/categories/api)

tourze/json-rpc-http-direct-call-bundle
=======================================

JsonRPC另外一种调用方式

1.1.0(4mo ago)08MITPHPCI passing

Since Apr 27Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/tourze/json-rpc-http-direct-call-bundle)[ Packagist](https://packagist.org/packages/tourze/json-rpc-http-direct-call-bundle)[ RSS](/packages/tourze-json-rpc-http-direct-call-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (24)Versions (12)Used By (0)

JSON-RPC HTTP Direct Call Bundle
================================

[](#json-rpc-http-direct-call-bundle)

[English](README.md) | [中文](README.zh-CN.md)

[![Latest Version](https://camo.githubusercontent.com/3ff941f0b0d0f733c4070f718bad83a49837057f926e51c487b87d5abed1829f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f6a736f6e2d7270632d687474702d6469726563742d63616c6c2d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/json-rpc-http-direct-call-bundle)[![Total Downloads](https://camo.githubusercontent.com/621b88c446abb792c90d98258c69cb97b7800c6f20c284c62bd12f462ca46645/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f6a736f6e2d7270632d687474702d6469726563742d63616c6c2d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/json-rpc-http-direct-call-bundle)[![PHP Version Require](https://camo.githubusercontent.com/702fb4c00b0b86d10bad95424f85d71bfa323d98c3e53c5f8561591d0e7462aa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f6a736f6e2d7270632d687474702d6469726563742d63616c6c2d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/json-rpc-http-direct-call-bundle)[![License](https://camo.githubusercontent.com/8ea9531da72a9251997bf765b180b9117a4e0b0c49f43a3f8c27ee2fb89173c0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f6a736f6e2d7270632d687474702d6469726563742d63616c6c2d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/json-rpc-http-direct-call-bundle)[![codecov](https://camo.githubusercontent.com/b1e0f313168dd3c9197aeaa27790e2f768887b8b56be82ed8262c2f9e798e73d/68747470733a2f2f636f6465636f762e696f2f67682f746f75727a652f7068702d6d6f6e6f7265706f2f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d434f4445434f565f544f4b454e)](https://codecov.io/gh/tourze/php-monorepo)

A Symfony bundle that provides HTTP direct call functionality for JSON-RPC services. This bundle offers an alternative approach to JSON-RPC invocation through HTTP endpoints.

Features
--------

[](#features)

- HTTP direct calls to JSON-RPC services
- Request/response encryption and decryption support
- Multiple calling interface forms
- Automatic route loading with attributes
- Built-in error handling and logging
- Support for prefixed and non-prefixed endpoints

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Symfony 7.3 or higher
- ext-json

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

[](#installation)

```
composer require tourze/json-rpc-http-direct-call-bundle
```

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

[](#configuration)

Add the bundle to your `config/bundles.php` file:

```
return [
    // ...
    Tourze\JsonRPCHttpDirectCallBundle\JsonRPCHttpDirectCallBundle::class => ['all' => true],
];
```

Quick Start
-----------

[](#quick-start)

### Direct Call Endpoint

[](#direct-call-endpoint)

Send POST requests to JSON-RPC methods using these endpoints:

```
# With prefix
POST /json-rpc/{prefix}/{method}.aspx

# Without prefix (CP endpoint)
POST /cp/json-rpc/{method}.aspx
```

Example request:

```
curl -X POST http://localhost/json-rpc/user/getInfo.aspx \
  -H "Content-Type: application/json" \
  -H "request-id: unique-request-id" \
  -d '{"userId": 123}'
```

### Direct POST Endpoint

[](#direct-post-endpoint)

Send POST requests directly to methods:

```
POST /json-rpc/call/{method}
```

Example request:

```
curl -X POST http://localhost/json-rpc/call/getUser \
  -d "userId=123&includeProfile=true"
```

Usage
-----

[](#usage)

### Controllers

[](#controllers)

The bundle provides two main controllers:

1. **DirectCallController** - Handles requests to `/json-rpc/{prefix}/{method}.aspx` and `/cp/json-rpc/{method}.aspx`
2. **DirectPostController** - Handles requests to `/json-rpc/call/{method}`

### Encryption Support

[](#encryption-support)

The bundle supports request/response encryption when the encryptor service detects encrypted endpoints:

```
// Automatic encryption detection based on request path
if ($this->encryptor->shouldEncrypt($request)) {
    $decryptedContent = $this->encryptor->decryptByRequest($request, $content);
    // Process decrypted content...
}
```

### Request ID Handling

[](#request-id-handling)

The bundle automatically handles request IDs:

- Uses `request-id` header if provided
- Generates UUID v4 if not provided
- Prefixes with endpoint prefix for tracking

Architecture
------------

[](#architecture)

```
src/
├── Controller/
│   ├── DirectCallController.php    # Main JSON-RPC endpoint controller
│   └── DirectPostController.php    # Direct POST endpoint controller
├── DependencyInjection/
│   └── JsonRPCHttpDirectCallExtension.php  # Service configuration
├── Exception/
│   └── UnexpectedControllerException.php   # Custom exceptions
├── Service/
│   └── AttributeControllerLoader.php       # Route auto-loader
└── JsonRPCHttpDirectCallBundle.php         # Bundle class

```

Testing
-------

[](#testing)

Run tests from the project root directory:

```
./vendor/bin/phpunit packages/json-rpc-http-direct-call-bundle/tests
```

Test coverage includes:

- Unit tests for all components
- Integration tests for complete workflows
- Mock services for dependencies

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

[](#contributing)

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance74

Regular maintenance activity

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Recently: every ~50 days

Total

11

Last Release

142d ago

Major Versions

0.1.4 → 1.0.02025-11-05

### Community

Maintainers

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

---

Top Contributors

[![tourze](https://avatars.githubusercontent.com/u/13899502?v=4)](https://github.com/tourze "tourze (3 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tourze-json-rpc-http-direct-call-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tourze-json-rpc-http-direct-call-bundle/health.svg)](https://phpackages.com/packages/tourze-json-rpc-http-direct-call-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M650](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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