1. Go to this page and download the library: Download domotruc/mqttgen 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/ */
domotruc / mqttgen example snippets
$filename = 'vendor/domotruc/mqttgen/topics.json';
$mqttgen = new MqttGen\MqttGen($filename);
do {
$mqttgen->nextMessage();
sleep(2);
} while (true);
}
catch (\Exception $e) {
print($e->getMessage() . PHP_EOL);
}