All Projects → mgdm → Mosquitto Php

mgdm / Mosquitto Php

Licence: bsd-3-clause
A wrapper for the Eclipse Mosquitto™ MQTT client library for PHP.

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Mosquitto Php

Qmqtt
MQTT Client for Qt
Stars: ✭ 409 (-8.71%)
Mutual labels:  mqtt, mqtt-client
asyncio-mqtt
Idomatic asyncio wrapper around paho-mqtt
Stars: ✭ 137 (-69.42%)
Mutual labels:  mqtt, mqtt-client
ArduinoMqtt
MQTT client for Arduino
Stars: ✭ 58 (-87.05%)
Mutual labels:  mqtt, mqtt-client
Hivemq Mqtt Client
HiveMQ MQTT Client is an MQTT 5.0 and MQTT 3.1.1 compatible and feature-rich high-performance Java client library with different API flavours and backpressure support
Stars: ✭ 402 (-10.27%)
Mutual labels:  mqtt, mqtt-client
Mqtt Panel
A web interface for MQTT
Stars: ✭ 315 (-29.69%)
Mutual labels:  mqtt, mqtt-client
mqtt-mock
mqtt压测工具。支持subscribe、publish压测方式,支持模拟客户端连接数。
Stars: ✭ 78 (-82.59%)
Mutual labels:  mqtt, mqtt-client
ESPecial
ESP32 automation with web interface and telegram bot
Stars: ✭ 77 (-82.81%)
Mutual labels:  mqtt, mqtt-client
mqttools
MQTT version 5.0 client and broker using asyncio
Stars: ✭ 44 (-90.18%)
Mutual labels:  mqtt, mqtt-client
Tdm
GUI application to discover and monitor devices flashed with https://github.com/arendst/Sonoff-Tasmota
Stars: ✭ 385 (-14.06%)
Mutual labels:  mqtt, mqtt-client
Kmansonoff
Firmware for ESP8266 based itead Sonoff switches for use with HomeAssistant / mqtt
Stars: ✭ 282 (-37.05%)
Mutual labels:  mqtt, mqtt-client
zmosq
MQTT/Mosquitto / ZeroMQ proxy
Stars: ✭ 22 (-95.09%)
Mutual labels:  mqtt, mqtt-client
Mqtt C
A portable MQTT C client for embedded systems and PCs alike.
Stars: ✭ 342 (-23.66%)
Mutual labels:  mqtt, mqtt-client
mqtt-datasource
MQTT Datasource for Grafana allows streaming data from any MQTT broker running either locally or remotely.
Stars: ✭ 99 (-77.9%)
Mutual labels:  mqtt, mqtt-client
wyzesense2mqtt
Configurable WyzeSense to MQTT Gateway intended for use with Home Assistant or other platforms that use MQTT discovery mechanisms.
Stars: ✭ 55 (-87.72%)
Mutual labels:  mqtt, mqtt-client
CODESYS-MQTT
MQTT client library for CODESYS, supporting all QoS
Stars: ✭ 63 (-85.94%)
Mutual labels:  mqtt, mqtt-client
WeConnect-mqtt
MQTT Client that publishes data from Volkswagen WeConnect
Stars: ✭ 14 (-96.87%)
Mutual labels:  mqtt, mqtt-client
Android Mqtt Service
A simple MQTT Service that will keep running for the duration of your Android application using the Paho Java MQTT Client.
Stars: ✭ 238 (-46.87%)
Mutual labels:  mqtt, mqtt-client
Emqtt
Erlang MQTT v5.0 Client
Stars: ✭ 253 (-43.53%)
Mutual labels:  mqtt, mqtt-client
node-deepstackai-trigger
Detects motion using Deepstack AI and calls registered triggers based on trigger rules.
Stars: ✭ 154 (-65.62%)
Mutual labels:  mqtt, mqtt-client
Wolfmqtt
wolfMQTT is a small, fast, portable MQTT client implementation, including support for TLS 1.3.
Stars: ✭ 316 (-29.46%)
Mutual labels:  mqtt, mqtt-client

Mosquitto-PHP

This is an extension to allow using the Eclipse Mosquitto™ MQTT client library with PHP. See the examples/ directory for usage.

Build Status

PHP 7 support

Thanks to Sara Golemon this extension now supports PHP 7. I would be grateful if anyone using PHP 7 could test it and let me know how it works out.

Requirements

  • PHP 5.3+
  • libmosquitto 1.2.x or later
  • Linux or Mac OS X. I do not have a Windows machine handy, though patches or pull requests are of course very welcome!

Installation

If you've used a pre-built package to install Mosquitto, you need to make sure you have the development headers installed. On Red Hat-derived systems, this is probably called libmosquitto-devel, and on Debian-based systems it will be libmosquitto-dev.

You may obtain this package using PECL:

pecl install Mosquitto-alpha

Alternatively, you can use the normal extension build process:

phpize
./configure --with-mosquitto=/path/to/libmosquitto
make
make install

Then add extension=mosquitto.so to your php.ini.

The --with-mosquitto argument is optional, and only required if your libmosquitto install cannot be found.

General operation

The underlying library is based on callbacks and asynchronous operation. As such, you have to call the loop() method of the Client frequently to permit the library to handle the messages in its queues. Also, you should use the callback functions to ensure that you only attempt to publish after the client has connected, etc. For example, here is how you would correctly publish a QoS=2 message:

<?php

use Mosquitto\Client;

$mid = 0;
$c = new Mosquitto\Client("PHP");
$c->onLog('var_dump');
$c->onConnect(function() use ($c, &$mid) {
    $mid = $c->publish("mgdm/test", "Hello", 2);
});

$c->onPublish(function($publishedId) use ($c, $mid) {
    if ($publishedId == $mid) {
        $c->disconnect();
    }
});

$c->connect("localhost");
$c->loopForever();

echo "Finished"

Documentation

Full documentation is available on ReadTheDocs.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].