simps-cloud/aliyun-iot

calling AliYun IoT services using the Simps framework.

v1.0.0 2020-05-09 03:12 UTC

This package is auto-updated.

Last update: 2024-03-29 04:05:49 UTC


README

使用 Simps框架 调用 阿里云物联网平台 服务(MQTT)

安装

使用composer进行安装或者直接使用git clone源码

composer create-project simps-cloud/aliyun-iot

git clone git@github.com:simps-cloud/aliyun-iot.git

使用

<?php

return [
    'host' => "{$YourProductKey}.iot-as-mqtt.{$region}.aliyuncs.com", // 连接域名
    'port' => 1883, // 端口默认1883
    'keepalive' => 300, // 心跳
    'client_id' => "d812edc1-18da-2085-0edf-a4a588c296d1", // clientID
    'device_name' => "",
    'device_secret' => "",
    'product_key' => "",
    'product_secret' => "",
];
  • 订阅
php bin/subscribe.php
  • 发布
php bin/simps.php http:start

curl http://127.0.0.1:9501/

⚠️内置的 MQTTClient 已标记废弃,请使用 simps/mqtt

🎉详细说明参考博客《基于Swoole使用MQTT协议连接阿里云物联网平台设备实现消息订阅》

⭐️支持请前往点个Star:Simps