jcubic / json-rpc
JSON-RPC server implementation for PHP
1.0.1
2026-09-08 19:17 UTC
Requires
- php: >=7.4
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-08 19:17:52 UTC
README
JSON-RPC server implementation for PHP.
Installation
composer require jcubic/json-rpc
Usage
Create one class with public methods and handle the request with an
instance of Jcubic\JsonRpc\Server:
<?php require 'vendor/autoload.php'; use Jcubic\JsonRpc\Server; class Service { public function test($message) { return "you send " . $message; } } (new Server(new Service()))->handle();
You can provide documentation for methods by adding a static field:
class Service { public function test($message) { /* ... */ } public static $test_documentation = "doc string"; }
The server exposes a built-in help method and system.describe
service description used by JSON-RPC clients.
Client
The matching JavaScript client is available as the npm package
@jcubic/json-rpc.
License
Copyright (c) 2009-2026 Jakub T. Jankiewicz
Released under the MIT License. See LICENSE for details.