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

ActiveLibrary

crcms/client
============

CRCMS Client

0197PHP

Since Jan 14Pushed 7y agoCompare

[ Source](https://github.com/crcms/client)[ Packagist](https://packagist.org/packages/crcms/client)[ RSS](/packages/crcms-client/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (1)Used By (0)

远程调用的统一客户端
==========

[](#远程调用的统一客户端)

使用方法
----

[](#使用方法)

### 加载引入

[](#加载引入)

> 如果您的Larvel版本&gt;5.5可忽略此设置

在`config/app.php`中增加

```
'providers' => [
    CrCms\Foundation\ConnectionPool\PoolServiceProvider::class,
    CrCms\Foundation\Client\ClientServiceProvider::class,
]

```

### 增加配置

[](#增加配置)

在`config/client.php`的`connections`中增加如下测试配置

```
'http' => [
    'driver' => 'http',
    'host' => 'blog.crcms.cn',
    'port' => 80,
    //资源连接器的配置，请参考guzzlehttp
    'settings' => [
        'timeout' => 1,
    ],
],

```

### 调用方法

[](#调用方法)

```
//实例化并设置连接
$client = $this->app->make('client.manager')->connection('http');
//发送请求
$client = $client->request('/',[]);
//获取当前连接
dump(get_class($client->getConnection()));
//获取连接池管理器
dump(get_class($client->getConnectionPoolManager()));
//获取当前的连接资源的响应
dump(get_class($client->getResponse()));
//获取资源响应内容
dd($client->getContent());

```

### 动态化配置

[](#动态化配置)

```
$client = $this->app->make('client.manager')->connection([
    'name' => 'http',
    'driver' => 'http',
    'host' => '192.168.1.12',
    'port' => 8500,
    'settings' => [
        'timeout' => 1,
    ],
]);

```

### 使用连接池

[](#使用连接池)

在`config/pool.php`的`connections`中增加配置(可选增加)

```
'client' => [
    'max_idle_number' => 50,//最大空闲数
    'min_idle_number' => 15,//最小空闲数
    'max_connection_number' => 20,//最大连接数
    'max_connection_time' => 3,//最大连接时间(s)
],

```

> **使用连接池时，以当前连接名称做为连接池名称**

支持的类型
-----

[](#支持的类型)

- Http

后期增加
----

[](#后期增加)

- Tcp
- WebSocket

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8d399a94699f3b91de6be249975ed2dee389fe10d3975518f420143ded5762fd?d=identicon)[hiword](/maintainers/hiword)

### Embed Badge

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

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

PHPackages © 2026

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