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

ActiveLibrary[API Development](/categories/api)

axguowen/gateway-client
=======================

Simple PHP Gateway Client Library

v1.0.0(2y ago)010Apache-2.0PHPPHP &gt;=7.2.5

Since Feb 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/axguowen/gateway-client)[ Packagist](https://packagist.org/packages/axguowen/gateway-client)[ RSS](/packages/axguowen-gateway-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PHP Gateway 客户端管理器
==================

[](#php-gateway-客户端管理器)

一个简单的 PHP Gateway 客户端连接管理工具

安装
--

[](#安装)

```
composer require axguowen/gateway-client

```

使用
--

[](#使用)

### 配置连接

[](#配置连接)

```
use \axguowen\facade\GatewayClient;

// Gateway配置信息设置（全局有效）
GatewayClient::setConfig([
    // 默认连接本机
    'default' => 'localhost',
    // 连接配置
    'connections' => [
        // 本机连接参数
        'localhost' => [
            // Gateway注册服务地址
            'register_address' => '127.0.0.1:1236',
            // 密钥, 为对应Register服务设置的密钥
            'secret_key' => '',
            // 连接超时时间，单位：秒
            'connect_timeout' => 3,
            // 与Gateway是否是长链接
            'persistent_connection' => false,
            // 禁用服务注册地址缓存
            'addresses_cache_disable' => false,
        ],
        // 其它主机连接参数
        'other' => [
            // Gateway注册服务地址
            'register_address' => '192.168.0.89:1236',
        ],
    ],
]);
```

### 简单使用

[](#简单使用)

```
use \axguowen\facade\GatewayClient;

// GatewayClient支持GatewayWorker中的所有接口(closeCurrentClient和sendToCurrentClient除外)
GatewayClient::sendToAll('{"message": "hello gateway!"}');
```

### 切换连接其它主机

[](#切换连接其它主机)

```
use \axguowen\facade\GatewayClient;
// 连接其它服务器
$gatewayClientOther = GatewayClient::connect('other');
$gatewayClientOther->sendToAll('{"message": "hello gateway!"}');
```

### 动态传入连接的主机参数

[](#动态传入连接的主机参数)

```
use \axguowen\facade\GatewayClient;
// 动态连接
$gatewayClient = GatewayClient::connect([
    // Gateway注册服务地址
    'register_address' => '192.168.0.90:1236',
    // 密钥, 为对应Register服务设置的密钥
    'secret_key' => '',
    // 连接超时时间，单位：秒
    'connect_timeout' => 3,
    // 与Gateway是否是长链接
    'persistent_connection' => false,
    // 禁用服务注册地址缓存
    'addresses_cache_disable' => false,
]);
$gatewayClient->sendToAll('{"message": "hello gateway!"}');
```

### 其它方法

[](#其它方法)

```
use \axguowen\facade\GatewayClient;
$data = '{"message": "hello gateway!"}';
GatewayClient::sendToAll($data);
GatewayClient::sendToClient($client_id, $data);
GatewayClient::closeClient($client_id);
GatewayClient::isOnline($client_id);
GatewayClient::bindUid($client_id, $uid);
GatewayClient::isUidOnline($uid);
GatewayClient::isUidsOnline($uids);
GatewayClient::getClientIdByUid($uid);
GatewayClient::unbindUid($client_id, $uid);
GatewayClient::sendToUid($uid, $dat);
GatewayClient::joinGroup($client_id, $group);
GatewayClient::sendToGroup($group, $data);
GatewayClient::leaveGroup($client_id, $group);
GatewayClient::getClientCountByGroup($group);
GatewayClient::getClientSessionsByGroup($group);
GatewayClient::getAllClientCount();
GatewayClient::getAllClientSessions();
GatewayClient::setSession($client_id, $session);
GatewayClient::updateSession($client_id, $session);
GatewayClient::getSession($client_id);
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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

829d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5bb2b3388238042a25cf42dc44e5ff84adc241510354abae9e91573556753205?d=identicon)[axguowen](/maintainers/axguowen)

---

Top Contributors

[![axguowen](https://avatars.githubusercontent.com/u/61955804?v=4)](https://github.com/axguowen "axguowen (2 commits)")

---

Tags

phpclientgateway

### Embed Badge

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

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

###  Alternatives

[razorpay/razorpay

Razorpay PHP Client Library

2024.8M44](/packages/razorpay-razorpay)[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)

PHPackages © 2026

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