PHPMQTT-CLI 正在参加 2020 年度 OSC 中国开源项目评选,请投票支持!
PHPMQTT-CLI 在 2020 年度 OSC 中国开源项目评选 中已获得 {{ projectVoteCount }} 票,请投票支持!
投票让它出道
已投票
PHPMQTT-CLI 获得 2020 年度 OSC 中国开源项目评选「最佳人气项目」 !
PHPMQTT-CLI 获得 2020 年度 OSC 中国开源项目评选「最佳人气项目」「最积极运营项目」 !
PHPMQTT-CLI 获得 2020 年度 OSC 中国开源项目评选「最积极运营项目」 !
授权协议 Apache
开发语言 PHP 查看源码 »
操作系统 跨平台
软件类型 开源软件
开源组织
地区 国产
投 递 者 沈唁
适用人群 未知
收录时间 2021-04-13

软件简介

PHPMQTT-CLI是基于PHPMQTT提供的命令行工具,支持发布和订阅。

  ____  _   _ ____  __  __  ___ _____ _____
|  _ \| | | |  _ \|  \/  |/ _ \_   _|_   _|
| |_) | |_| | |_) | |\/| | | | || |   | |
|  __/|  _  |  __/| |  | | |_| || |   | |
|_|   |_| |_|_|   |_|  |_|\__\_\|_|   |_|

安装

composer require simps/mqtt-cli

使用

Publish

$ php vendor/bin/mqtt publish --help
Description:
Publishing simple messages
Usage:
publish [options]
Options:
-H, --host[=HOST]                        Specify the host to connect to [default: "localhost"]
-P, --port[=PORT]                        Connect to the port specified [default: 1883]
-t, --topic=TOPIC                        The MQTT topic on which to publish the message
-m, --message=MESSAGE                    Send a single message from the command line
-i, --id[=ID]                            The id to use for this client [default: ""]
--qos[=QOS]                          Specify the quality of service to use for the message, from 0, 1 and 2 [default: 0]
--dup[=DUP]                          If the DUP flag is set to 0, it indicates that this is the first occasion that the Client or Server has attempted to send this PUBLISH packet [default: 0]
-r, --retain[=RETAIN]                    If the RETAIN flag is set to 1 in a PUBLISH packet sent by a Client to a Server, the Server MUST replace any existing retained message for this topic and store the Application Message [default: 0]
-u, --username[=USERNAME]                Provide a username to be used for authenticating with the broker
-p, --pw[=PW]                            Provide a password to be used for authenticating with the broker
-c, --clean-session[=CLEAN-SESSION]      Setting the 'clean session' flag [default: true]
-l, --level=LEVEL                        MQTT Protocol level [default: 4]
-k, --keepalive[=KEEPALIVE]              The number of seconds between sending PING commands to the broker for the purposes of informing it we are still connected and functioning [default: 0]
--will-topic[=WILL-TOPIC]            The topic on which to send a Will, in the event that the client disconnects unexpectedly
--will-message[=WILL-MESSAGE]        Specify a message that will be stored by the broker and sent out if this client disconnects unexpectedly
--will-qos[=WILL-QOS]                The QoS to use for the Will [default: 0]
--will-retain[=WILL-RETAIN]          If given, if the client disconnects unexpectedly the message sent out will be treated as a retained message [default: 0]
-S, --ssl[=SSL]                          Enable SSL encryption [default: false]
--config-path[=CONFIG-PATH]          Setting the Swoole config file path
--properties-path[=PROPERTIES-PATH]  Setting the Properties config file path
-h, --help                               Display help for the given command. When no command is given display help for the list command
-q, --quiet                              Do not output any message
-V, --version                            Display this application version
--ansi                               Force ANSI output
--no-ansi                            Disable ANSI output
-n, --no-interaction                     Do not ask any interactive question
-v|vv|vvv, --verbose                     Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
An MQTT version 3.1/3.1.1/5.0 client for publishing simple messages

Subscribe

$ php vendor/bin/mqtt subscribe --help
Description:
Subscribing to topics
Usage:
subscribe [options]
Options:
-H, --host[=HOST]                        Specify the host to connect to [default: "localhost"]
-P, --port[=PORT]                        Connect to the port specified [default: 1883]
-i, --id[=ID]                            The id to use for this client [default: ""]
--qos=QOS                            Specify the quality of service to use for the message, from 0, 1 and 2 (multiple values allowed)
-t, --topic=TOPIC                        The MQTT topic to subscribe to (multiple values allowed)
-u, --username[=USERNAME]                Provide a username to be used for authenticating with the broker
-p, --pw[=PW]                            Provide a password to be used for authenticating with the broker
-c, --clean-session[=CLEAN-SESSION]      Setting the 'clean session' flag [default: true]
-l, --level=LEVEL                        MQTT Protocol level [default: 4]
-k, --keepalive[=KEEPALIVE]              The number of seconds between sending PING commands to the broker for the purposes of informing it we are still connected and functioning [default: 0]
--will-topic[=WILL-TOPIC]            The topic on which to send a Will, in the event that the client disconnects unexpectedly
--will-message[=WILL-MESSAGE]        Specify a message that will be stored by the broker and sent out if this client disconnects unexpectedly
--will-qos[=WILL-QOS]                The QoS to use for the Will [default: 0]
--will-retain[=WILL-RETAIN]          If given, if the client disconnects unexpectedly the message sent out will be treated as a retained message [default: 0]
-S, --ssl[=SSL]                          Enable SSL encryption [default: false]
--config-path[=CONFIG-PATH]          Setting the Swoole config file path
--properties-path[=PROPERTIES-PATH]  Setting the Properties config file path
-U, --unsubscribe[=UNSUBSCRIBE]          Topics that need to be unsubscribed (multiple values allowed)
-e, --event[=EVENT]                      Subscribed EventDispatcher [default: ""]
  -n, --no-interaction                     Do not ask any interactive question
  -v|vv|vvv, --verbose                     Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

展开阅读全文

代码

的 Gitee 指数为
超过 的项目

评论 (0)

加载中
更多评论
暂无内容
发表了博客
2018/08/04 15:59

PHPMQTT问题一二三

问题一:PHPMQTT作为客户端订阅超过一定数量的主题后,系统就会报错。 思路:在网上查找原因,失败; 打开调试debug = true ; 结果proc方法中报错: eof receive 问题二:为什么读不到socket呢? MQTT为TCP传输协议:遵循TCP三次握手协议,所以对MQTT有重新理了一次; 在MQTT群里咨询,请教大佬; 一个技术大姐:(其实没我大多少):让我看看MQTT日志报错; 于是查看MQTT错误日志同时报错: 2018-07-27 18:43:18.412 [error] ...

0
0
发表了博客
2013/05/26 18:23

一个新的开源PHP MQTT 客户端代码库——PHPMQTT

It seems finally we may be freed from the unstable shakiness which is embodied in PHP_SAM – the only PHP based MQTT client….until now. Project SAM is a PHP library for several different pubsub messaging systems, one being MQTT. However it suffers from a very restrictive licence, a lack of maintenance and quite a few bugs. Previously there was no choice if you wished to use MQTT and PHP, now ...

0
2
发表了博客
2018/03/02 11:35

php windows环境 安装 Apache-apollo + phpMQTT 实现发送 MQTT

首先安装Apache-apollo 原文链接: http://blog.csdn.net/marrn/article/details/71141122?utm_source=itdadao&utm_medium=referral 1.首先从http://activemq.apache.org/apollo/download.html官网上下载windows对应的apollo版本,本文下载的是apache-apollo-1.7.1-windows-distro.zip 版本。windows的版本为win10,JDK版本1.8。 2.解压到C:\apache-apollo下,此时会多出一个apache-apollo-1.7.1文件夹。 3.然后以管理员的身份运...

0
0
2019/07/15 18:25

cli

Vue CLI vue.config.js : a optional config file module.exports = { // options } baseUrl : 过时了 publicPath: '/' 条件值: publicPath: process.env.NODE_ENV === 'production' ? '/production-sub-path/' : '/' outputDir : 'dist' , 指定编译打包时的目标目录 assetsDir : '' 资源目录 : 静态资源目录 ,相对于outputDir indexPath: 'index.html' , 指定index.html文件的生成路径,相对于outputDir filenameHashing : t...

0
0
发表于开发技能专区
2016/11/02 16:06

go/cli

之前有go的基础,也看过一些框架,目前的go/cli不需要gopath的支持,自包含了所有的第三方库,以助于提高开发效率!

0
0
发表了博客
2020/08/09 14:42

cli

```java public static void main(String[] args) { Options options = new Options(); CommandLineParser commandLineParser = new DefaultParser(); options.addOption("h", "usage help"); options.addOption(Option.builder("d").longOpt("decompress").type(String.class).desc("Decompress the JFR file").build()); options.addOption(Option.builder("f").longOpt("jfrdump").argName("jfr file path").hasArg(true).de...

0
0
没有更多内容
加载失败,请刷新页面
点击加载更多
加载中
下一页
暂无内容
0 评论
4 收藏
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部