PHP code example of enzolarosa / mqtt-broadcast

1. Go to this page and download the library: Download enzolarosa/mqtt-broadcast library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

enzolarosa / mqtt-broadcast example snippets


return [
    'logs' => [
        'enable' => env('MQTT_LOG_ENABLE', true),
        'connection' => env('MQTT_LOG_CONNECTION', 'logs'),
        'table' => env('MQTT_LOG_TABLE', 'mqtt_loggers'),
    ],

    'password' => env('MQTT_MASTER_PASS', Illuminate\Support\Str::random(32)),

    'connections' => [
        'local' => [
            'host' => env('MQTT_HOST', '127.0.0.1'),
            'port' => env('MQTT_PORT', '1883'),
            'user' => env('MQTT_USER'),
            'password' => env('MQTT_PASSWORD'),
        ],

        'remote' => [
            'host' => env('MQTT_REMOTE_HOST', '127.0.0.1'),
            'port' => env('MQTT_REMOTE_PORT', '1883'),
            'user' => env('MQTT_REMOTE_USER'),
            'password' => env('MQTT_REMOTE_PASSWORD'),
        ],
    ]
];

$mqttBroadcast = new enzolarosa\MqttBroadcast();
echo $mqttBroadcast->echoPhrase('Hello, enzolarosa!');
bash
php artisan vendor:publish --tag="mqtt-broadcast-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="mqtt-broadcast-config"
bash
php artisan vendor:publish --tag="mqtt-broadcast-views"