2017 © Pedro Peláez
 

library php-mqtt-client

MQTT 3.1.1 library for PHP with TLS support

image

pascalwacker/php-mqtt-client

MQTT 3.1.1 library for PHP with TLS support

  • Tuesday, December 12, 2017
  • by pascalwacker
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 8 % Grown

The README.md

php-mqtt-client

MQTT 3.1.1 Client with TSL support in PHP, (*1)

Note that all calls are blocking until a timeout occurs. If you need some fancy async solution, you'll have to find another repo., (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist karpy47/php-mqtt-client

or add, (*5)

"karpy47/php-mqtt-client": "*"

to the require section of your composer.json., (*6)

Requirements

Should work with all recent PHP versions., (*7)

Code developed and running in production using PHP v5.6.27, (*8)

Not tested on PHP v7, please report back!, (*9)

Basic Usage

$client = new MQTTClient('mqtt-server.domain.com', 8162);
$client->setAuthentication('mqtt-server.username','mqtt-server.password');
$client->setEncryption('cacerts.pem');
$success = $client->sendConnect(12345);  // set your client ID
if ($success) {
    $client->sendSubscribe('topic1');
    $client->sendPublish('topic2', 'Message to all subscribers of this topic');
    $messages = $client->getPublishMessages();  // now read and acknowledge all messages waiting
    foreach ($messages as $message) {
        echo $message['topic'] .': '. $message['message'] . PHP_EOL;
    }
    $client->sendDisconnect();    
}
$client->close();

Credits

Thanks to bluerhinos/phpMQTT and McFizh/libMQTT., (*10)

License

Released under the MIT License. Please see License File for more information., (*11)

The Versions

12/12 2017

dev-master

9999999-dev

MQTT 3.1.1 library for PHP with TLS support

  Sources   Download

MIT

by Avatar pascalwacker

php client mqtt

12/12 2017

1.0.3

1.0.3.0

MQTT 3.1.1 library for PHP with TLS support

  Sources   Download

MIT

by Avatar pascalwacker

php client mqtt

12/12 2017

1.0.2

1.0.2.0

MQTT 3.1.1 library for PHP with TLS support

  Sources   Download

MIT

by Avatar pascalwacker

php client mqtt

09/08 2017

1.0.1

1.0.1.0

MQTT 3.1.1 library for PHP with TLS support

  Sources   Download

MIT

by Avatar karpy47

php client mqtt