PHPackages                             larananas/lumen-json-rpc - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. larananas/lumen-json-rpc

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

larananas/lumen-json-rpc
========================

Framework-free JSON-RPC 2.0 server library for modern PHP.

v1.0.0(1mo ago)395[1 PRs](https://github.com/larananas/lumen-json-rpc/pulls)LGPL-3.0-or-laterPHPPHP &gt;=8.2CI passing

Since Apr 17Pushed 4d ago1 watchersCompare

[ Source](https://github.com/larananas/lumen-json-rpc)[ Packagist](https://packagist.org/packages/larananas/lumen-json-rpc)[ RSS](/packages/larananas-lumen-json-rpc/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (5)Dependencies (4)Versions (8)Used By (0)

Lumen JSON-RPC
==============

[](#lumen-json-rpc)

 [![Lumen JSON-RPC logo](https://camo.githubusercontent.com/f304c468cb479b3612c9de513fac53efba7e99ad922a07275b423c146dcf0a08/68747470733a2f2f6c6172616e616e61732e6769746875622e696f2f6c756d656e2d6a736f6e2d7270632f6c6f676f2e737667)](https://camo.githubusercontent.com/f304c468cb479b3612c9de513fac53efba7e99ad922a07275b423c146dcf0a08/68747470733a2f2f6c6172616e616e61732e6769746875622e696f2f6c756d656e2d6a736f6e2d7270632f6c6f676f2e737667)

[![Tests](https://github.com/larananas/lumen-json-rpc/actions/workflows/ci.yml/badge.svg)](https://github.com/larananas/lumen-json-rpc/actions/workflows/ci.yml)[![License: LGPL-3.0-or-later](https://camo.githubusercontent.com/7b17128465cb7dbc4f08f00cfcdeb0c586cb208bed53b5a39c84e07d2c5a2b20/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4c47504c2d2d332e302d2d6f722d2d6c617465722d626c75652e737667)](LICENSE)[![PHP](https://camo.githubusercontent.com/7f0037338af137aa8ea57c4cafd6b4cb48b79238fc11d1e40aee1c3951ed06a7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d6d6f6465726e2d3737376262342e737667)](#)[![Docs](https://camo.githubusercontent.com/04b5b4aa38040998974906eb0dac19f34d5eb859b77a75f5c20583b1480f957a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d776562736974652d626c75652e737667)](https://larananas.github.io/lumen-json-rpc/)

> ✨ Framework-free JSON-RPC for PHP — strict `handler.method` routing, strong defaults, auth drivers, gzip, rate limiting, middleware, lightweight schema validation, direct JSON usage, and docs generation.

A framework-free JSON-RPC 2.0 server library for modern PHP.

It keeps the boring parts solid — request validation, batching, auth, compression, rate limiting, hooks, docs, and predictable handler execution — while keeping your application code explicit and reviewable.

---

📚 Documentation
---------------

[](#-documentation)

Full documentation is available at the documentation website: .

---

🚀 Why this feels good in real projects
--------------------------------------

[](#-why-this-feels-good-in-real-projects)

Lumen JSON-RPC is built for developers who want a **real server library**, not a vague protocol toolkit and not a heavy framework abstraction.

### You get, out of the box

[](#you-get-out-of-the-box)

- 🧱 **Standalone library** — plain PHP, no framework required
- 🎯 **Strict `handler.method` mapping** — predictable and easy to review
- 🔐 **Auth drivers built in** — JWT, API key, or HTTP Basic
- 🧩 **Direct JSON usage** — use HTTP by default, or call `JsonRpcServer::handleJson()` directly
- 🧪 **Strong protocol handling** — strict request validation, batching, notifications
- 🛡️ **Safe defaults** — reserved methods blocked, magic methods excluded, public instance methods only
- 🗜️ **Compression + rate limiting** — useful production features without extra packages
- 🪝 **Hooks + middleware** — extension points without turning the library into a framework
- 📚 **Docs generation** — generate API docs from your handlers

### What it is trying to be

[](#what-it-is-trying-to-be)

A clean JSON-RPC 2.0 server for PHP that stays:

- explicit
- composable
- easy to wire into a plain app
- strict enough to be trusted

### What it is **not** trying to be

[](#what-it-is-not-trying-to-be)

- a full framework
- a giant DI container
- a magical procedure registry
- a “bring 12 packages before hello world” library

---

📦 Install
---------

[](#-install)

> **Documentation website**: [larananas.github.io/lumen-json-rpc](https://larananas.github.io/lumen-json-rpc/)

```
composer require larananas/lumen-json-rpc
```

Requires `PHP >=8.2` and `ext-json`.

Composer consumers install the normal tagged package archive. Repository-only assets such as tests, examples, source docs, CI workflows, and docs-site tooling are intentionally excluded from package archives.

### Optional extras

[](#optional-extras)

- `ext-zlib` → enables gzip request / response support
- `firebase/php-jwt` → enables broader JWT algorithm support

Without optional extras, the library still works.

---

✅ Quality and release checks
----------------------------

[](#-quality-and-release-checks)

- `composer qa` runs the standard local release gate: validate, audit, package verify, lint, PHPStan level 9, and PHPUnit
- `composer qa:max` extends that local gate with coverage threshold checks and mutation testing; it requires a local coverage driver
- `composer test:coverage` and `composer mutate` require a local coverage driver: use `XDEBUG_MODE=coverage`, enable `xdebug.mode=coverage`, or install PCOV
- CI covers the same release areas across `quality`, `tests`, `coverage`, and `mutation` jobs; PHPUnit runs on PHP 8.2/8.3/8.4, while quality, coverage, and mutation run on PHP 8.3

---

⚡ Quick Start
-------------

[](#-quick-start)

### 1) Create an entry point (`public/index.php`)

[](#1-create-an-entry-point-publicindexphp)

```
