https://github.com/airootuser/laravel-mqtt-publish
A laravel mqtt publisher
https://github.com/airootuser/laravel-mqtt-publish
laravel mqtt php
Last synced: 8 months ago
JSON representation
A laravel mqtt publisher
- Host: GitHub
- URL: https://github.com/airootuser/laravel-mqtt-publish
- Owner: AIRootUser
- Created: 2016-12-15T00:41:02.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-10-14T17:32:00.000Z (almost 8 years ago)
- Last Synced: 2025-09-19T21:05:13.391Z (10 months ago)
- Topics: laravel, mqtt, php
- Language: PHP
- Homepage:
- Size: 53.7 KB
- Stars: 21
- Watchers: 2
- Forks: 10
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel Mqtt Publisher
Mqtt is used to publish messages from backend to andriod.
### Getting start
`
composer require luzhuqun/laravel-mqtt-publish
`
### How to use
use Lzq\Mqtt\SamMessage;
use Lzq\Mqtt\SamConnection;
$conn = new SAMConnection();//create a new connection object
$conn->connect('mqtt', array('SAM_HOST' => '192.168.10.147', 'SAM_PORT' => '1883'));//start initialise the connection
$msgCpu = new SAMMessage('hehe');//create a new MQTT message with the output of the shell command as the body
$conn->send('topic://'.'tokudu/ab7867d9fd60db65', $msgCpu);//send the message on the topic cpu
$conn->disconnect();
### Learn more
A complet mqtt service incluede publisher, service and subscriber.
##### service
[mosquitto](https://github.com/eclipse/mosquitto)
##### subscriber
[AndroidPushNotificationsDemo](https://github.com/tokudu/AndroidPushNotificationsDemo)