Skip to content

Latest commit

 

History

History
 
 

mqtt-client-PHP

PHP MQTT client usage example

In this example, we provide the sample code for connecting to MQTT Broker through TCP and TLS protocols.

The example selects the client library php-mqtt/client with the most downloads on composer, and there are also some other excellent libraries based on Swoole that welcome everyone to use it and submit the sample and list to it.

For more documentation about php-mqtt/client, please refer to Packagist php-mqtt/client.

Precondition

PHP 7.4 or later

Installation

composer require php-mqtt/client

Running

php pubsub_tcp.php

Reference

How to use MQTT in PHP