PHPackages                             ant-corp/mqtt-server - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ant-corp/mqtt-server

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ant-corp/mqtt-server
====================

hyperf Mqtt服务端

4442PHP

Since Mar 29Pushed 5y agoCompare

[ Source](https://github.com/Yrcorp/MqttServer)[ Packagist](https://packagist.org/packages/ant-corp/mqtt-server)[ RSS](/packages/ant-corp-mqtt-server/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

基于 hyperf 开发的 mqtt服务端
=====================

[](#基于-hyperf-开发的-mqtt服务端)

安装
--

[](#安装)

```
$ composer require ant-corp/mqtt-server
```

使用
--

[](#使用)

### 在 config/server.php 添加

[](#在-configserverphp-添加)

```
use AntCorp\MqttServer\Events\MqttServer;
use AntCorp\MqttServer\Protocol\Types;
use AntCorp\MqttServer\Version\V3;

[
    'name' => 'mqtt',
    'type' => Server::SERVER_BASE,
    'host' => '0.0.0.0',
    'version' => V3::class,
    'port' => 9601,
    'sock_type' => SWOOLE_SOCK_TCP,
    'callbacks' => [
        Event::ON_RECEIVE => [AntCorp\MqttServer\Server::class, 'onReceive'],
    ],
    'receiveCallbacks' => [
        Types::CONNECT => [MqttServer::class, 'onMqConnect'],
        Types::PINGREQ => [MqttServer::class, 'onMqPingreq'],
        Types::DISCONNECT => [MqttServer::class, 'onMqDisconnect'],
        Types::PUBLISH => [MqttServer::class, 'onMqPublish'],
        Types::SUBSCRIBE => [MqttServer::class, 'onMqSubscribe'],
        Types::UNSUBSCRIBE => [MqttServer::class, 'onMqUnsubscribe'],
    ],
    'settings' => [
        'open_mqtt_protocol' => true, // 启用 EOF 自动分包
        'package_eof' => "\r\n", // 设置 EOF 字符串
        'package_max_length' => 2000000,
    ],
]
```

### 特别鸣谢

[](#特别鸣谢)

[simps](https://github.com/simple-swoole/simps)

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity30

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.

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/ant-corp-mqtt-server/health.svg)

```
[![Health](https://phpackages.com/badges/ant-corp-mqtt-server/health.svg)](https://phpackages.com/packages/ant-corp-mqtt-server)
```

###  Alternatives

[ctidigital/magento2-configurator

Keep magento persistently configured using files

174317.4k](/packages/ctidigital-magento2-configurator)[comcast/php-legal-licenses

A utility to generate a Licenses file containing the full license text for every dependency in your project for legal purposes.

821.1M9](/packages/comcast-php-legal-licenses)[xfra35/f3-cron

Job scheduling for the PHP Fat-Free Framework

73107.5k](/packages/xfra35-f3-cron)[bagusindrayana/laravel-coordinate

get nearby location from eloquent laravel

3019.7k](/packages/bagusindrayana-laravel-coordinate)

PHPackages © 2026

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