PHPackages                             luojixinhao/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. [API Development](/categories/api)
4. /
5. luojixinhao/rpc

ActiveLibrary[API Development](/categories/api)

luojixinhao/rpc
===============

rpc

V1.0(8y ago)15MITPHPPHP &gt;=5.3.0

Since Sep 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/luojixinhao/rpc)[ Packagist](https://packagist.org/packages/luojixinhao/rpc)[ Docs](https://github.com/luojixinhao/rpc)[ RSS](/packages/luojixinhao-rpc/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

关于
--

[](#关于)

简单的RPC类库。

需求
--

[](#需求)

PHP 5.3 +

安装
--

[](#安装)

composer require luojixinhao/rpc:\*

联系
--

[](#联系)

Email: [lx\_2010@qq.com](mailto:lx_2010@qq.com)

示例
--

[](#示例)

```
/*服务端*/
class API {

	public function api1($arg1 = '', $arg2 = '') {
		return "API1返回数据: 参数1={$arg1}，参数2={$arg2}";
	}

	public function api2($arg1 = '', $arg2 = '') {
		return array('API2返回数据', $arg1, $arg2);
	}

	protected function api3() {
		return '这个不可调用，返回“ERROR”';
	}

}

$service = new rpcServer(new API());
$service->handle();
```

```
/* 客户端 */
$client = new rpcClient("http://localhost/rpcserver/");

$result = $client->api0();
//不存在的方法，返回：ERROR

$result = $client->api1('一', '二');
//返回：API1返回数据: 参数1=一，参数2=二

$result = $client->api2('一', array('二'));
//返回：
//Array
//(
//    [0] => API2返回数据
//    [1] => 一
//    [2] => Array
//        (
//            [0] => 二
//        )
//
//)

$result = $client->api3();
//受保护的方法，返回：ERROR

$client->reset(); //调用其他RPC服务时，需要执行复位，以免后面再次调用前面的RPC

rpcClient::call("http://localhost/rpcserver/?1", "api1", "parameters1", function() {
	echo '回调参数：';
	print_r(func_get_args());
});
rpcClient::call("http://localhost/rpcserver/?2", "api2", array("parameters1", "parameters2"), function() {
	echo '回调参数：';
	print_r(func_get_args());
});
$re = rpcClient::loop();
//返回：
//Array
//(
//    [1] => Array
//        (
//            [content] => Array
//                (
//                    [0] => API2返回数据
//                    [1] => parameters1
//                    [2] => parameters2
//                )
//
//            [url] => http://localhost/rpcserver/?2
//        )
//
//    [2] => Array
//        (
//            [content] => API1返回数据: 参数1=parameters1，参数2=
//            [url] => http://localhost/rpcserver/?1
//        )
//
//)
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3163d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

rpc

### Embed Badge

![Health badge](/badges/luojixinhao-rpc/health.svg)

```
[![Health](https://phpackages.com/badges/luojixinhao-rpc/health.svg)](https://phpackages.com/packages/luojixinhao-rpc)
```

###  Alternatives

[apache/thrift

Apache Thrift RPC system

10.9k2.1M41](/packages/apache-thrift)[grpc/grpc

gRPC library for PHP

507116.6M180](/packages/grpc-grpc)[sajya/server

Easy implementation of the JSON-RPC 2.0 server for the Laravel framework.

2391.9M4](/packages/sajya-server)[lstrojny/fxmlrpc

Fast and tiny XML/RPC client with bridges for various HTTP clients

1425.4M30](/packages/lstrojny-fxmlrpc)[jsonrpc/jsonrpc

JSON-RPC 2.0 client/server implementation

53407.1k4](/packages/jsonrpc-jsonrpc)[tivoka/tivoka

The universal JSON-RPC client/server library. JSON-RPC done right!

74159.0k3](/packages/tivoka-tivoka)

PHPackages © 2026

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