chat-x/mqtt 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

chat-x/mqtt

最新稳定版本:1.0.2

Composer 安装命令:

composer require chat-x/mqtt

包简介

An MQTT connection dependency

README 文档

README

A simple package that MQTT connection dependency.

Installation

You can install the package via Composer: composer require chat-x/mqtt

Usage

use ChatX\Mqtt\MqttPHP;

Example

$mqtt = new MqttPHP('127.0.0.1', '1883', $client_id);
$mqtt->connect(true, null, null, null);

publish

$mqtt->publish('test/topic', 'Hello, MQTT!', 0);

subscribe

$callback = function($topic, $message) {
    echo "Received message on topic 【{$topic}】 Message: 【{$message}】\n";
};

$topics['test/topic'] = ["qos" => 0, "function" => $callback];
$mqtt->subscribe($topics, 0);

Testing

composer test

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-31