Go to file
Salman Zafar 99393db4a3 updated config.php documentation 2019-02-25 15:52:37 +05:00
.idea updated config.php documentation 2019-02-25 15:52:37 +05:00
src added Example of publishing topic 2019-02-25 14:52:53 +05:00
.gitignore Working on documentation 2019-02-25 14:30:35 +05:00
Readme.md updated config.php documentation 2019-02-25 15:52:37 +05:00
composer.json added auto discovery 2019-02-25 13:10:49 +05:00

Readme.md

Laravel MQTT Package

A simple Package that can be used to connect to Mqtt using laravel

It uses bluerhinos/phpMQTT as a base.

Features

  • Name and Password Authentication
  • Certificate Protection for end to end encryption
  • Enable Debug mode to make it easier for debugging

Config.php

    'host' => env('mqtt_host','127.0.0.1'),
    'password' => env('mqtt_password',''),
    'username' => env('mqtt_username',''),
    'certfile' => env('mqtt_cert_file',''),
    'port' => env('mqtt_port','1883'),
    'debug' => env('mqtt_debug',false) //Optional Parameter to enable debugging set it to True

Publishing topic

use Salman\Mqtt\MqttClass\Mqtt;

public function SendMsgViaMqtt($topic, $message)
{
        $mqtt = new Mqtt();
        $output = $mqtt->ConnectAndSendMessage($topic, $message);

        if ($output === true)
        {
            return true;
        }

        return false;
}

Tested on php 7.3 and laravel 5.7

Full documentation Coming Soon