PHPackages                             connor/rpc-client - 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. connor/rpc-client

ActiveLibrary[API Development](/categories/api)

connor/rpc-client
=================

微服务rpc 调用client

1.0.1(8y ago)213MITPHP

Since Apr 3Pushed 7y ago1 watchersCompare

[ Source](https://github.com/cclehui/RpcClient)[ Packagist](https://packagist.org/packages/connor/rpc-client)[ RSS](/packages/connor-rpc-client/feed)WikiDiscussions master Synced 2w ago

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

适用场景
----

[](#适用场景)

在微服务和服务化的场景下，项目之间存在很多的远程调用场景，在一次请求中存在多次的远程rpc调用， 这种远程调用有的是基于tcp的，有的是基于http的， 为了提升调用性能，我们必须支持异步并发调用， 同时，我们还必须跟踪每次调用的调用链。RpcClient正好解决用来解决这两个问题。

安装
--

[](#安装)

直接通过composer安装

功能和使用说明
-------

[](#功能和使用说明)

### 基于http协议的rpc调用

[](#基于http协议的rpc调用)

HttpRpcClientUtil 在guzzle promise的基础上提供了同步和异步的http 远程调用类封装，在log中 收集了调用的信息，可以用于调用链的性能分析

```
//配置不同的handler来处理
$config = [
//        'handler' => new \GuzzleHttp\Handler\StreamHandler(),
//    'handler' => new \CClehui\RpcClient\GuzzleHandler\StreamSocketHandler(),
    'handler' => new \CClehui\RpcClient\GuzzleHandler\SocketHandler(),
];

//同步调用demo
$url = 'http://0.0.0.0/temp/test.php;
$params = [];
$rpc_client = new \CClehui\RpcClient\HttpRpcClientUtil();
$rpc_client->setGuzzleClientConfig($config);
$res = $rpc_client->callRemote($url, $params);

//异步调用demo (promise机制)
$url = 'http://0.0.0.0/temp/test.php';
$params = [];
$promises = [];
$rpc_client = new \CClehui\RpcClient\HttpRpcClientUtil();();
$rpc_client->setGuzzleClientConfig($config);

for ($i = 1; $i callRemote($url, $params, 'GET', [], true);
}

$result_list = \GuzzleHttp\Promise\settle($promises)->wait();

foreach($result_list as $key => $item) {
    $response = $item['value'];

    $response = (string)$response->getBody();
    echo $response . "\n";
}
```

更详细的使用demo在 examples\\HttpRpcDemo.php中

### StreamSocketHandler

[](#streamsockethandler)

见demo中的config配置， 可以配置该handler

### SocketHandler

[](#sockethandler)

见demo中的config配置， 可以配置该handler

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Total

2

Last Release

3010d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5411898?v=4)[lehui](/maintainers/cclehui)[@cclehui](https://github.com/cclehui)

---

Top Contributors

[![cclehui](https://avatars.githubusercontent.com/u/5411898?v=4)](https://github.com/cclehui "cclehui (29 commits)")

---

Tags

clientrpc

### Embed Badge

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

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[googleads/googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP

67410.4M25](/packages/googleads-googleads-php-lib)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.5M11](/packages/checkout-checkout-sdk-php)

PHPackages © 2026

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