foglcz/jsonrpc2
Composer 安装命令:
composer require foglcz/jsonrpc2
包简介
jsonrpc2 implementation for generic use. Test suite for Nette Framework included.
README 文档
README
This library contains a PHP implementation of JSON-RPC version 2. This libraray implements both a client and a server.
⛔‼️ Deprecation notice ‼️⛔
As of January 2026 this repository is in archive mode. Furher development of this library will take place here.
Installation
Download the contents of the lib folder to your project. Then simply include
the appropriate library:
include "lib/Server.php"; include "lib/Client.php";
Server example
$server = new Lightbulb\Json\Rpc2\Server; // Add functions to the server object to make them callable remotely // Built in PHP functions or user functions $server->upper = 'strtoupper'; $server->getID = 'findUserID'; // Class based: All public methods in MyClass are exposed as user.method $server->user = new MyClass; // Receive and process any incoming RPC calls $server->handle();
Client example
$url = 'http://api.domain.com/endpoint'; $client = new Lightbulb\Json\Rpc2\Client($url); $str = $client->upper("kitten"); $id = $client->getID("Jason Doolis");
Client supports class chaining to call nested methods
$ok = $client->user->mail->login($user, $pass); // Maps to 'user.mail.login'
License
Licensed under the New BSD License. Copyright 2011 Pavel Ptacek. All rights reserved.
统计信息
- 总下载量: 63.5k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 19
- 点击次数: 11
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: New
- 更新时间: 2012-07-26