PHPackages                             unreal4u/mqtt - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. unreal4u/mqtt

ActiveLibrary[API Development](/categories/api)

unreal4u/mqtt
=============

Complete MQTT v3.1.1 implementation for PHP &gt;=7.1.x

v1.1.1(7y ago)161.5k4[3 issues](https://github.com/unreal4u/mqtt/issues)[1 PRs](https://github.com/unreal4u/mqtt/pulls)2MITPHPPHP &gt;=7.0.0CI failing

Since Dec 11Pushed 5y ago2 watchersCompare

[ Source](https://github.com/unreal4u/mqtt)[ Packagist](https://packagist.org/packages/unreal4u/mqtt)[ RSS](/packages/unreal4u-mqtt/feed)WikiDiscussions master Synced today

READMEChangelog (8)Dependencies (7)Versions (10)Used By (2)

unreal4u/MQTT
=============

[](#unreal4umqtt)

Complete PHP7.1+ MQTT client with full support for [the MQTT version 3.1.1 protocol](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/mqtt-v3.1.1.html). This package is an entire rewrite of [McFizh/libMQTT](https://github.com/McFizh/libMQTT).

This project in badges
----------------------

[](#this-project-in-badges)

[![Latest Stable Version](https://camo.githubusercontent.com/f5b2f08b5901b5f386d196b4cf7f5ffe28ecc62d990ede864a087f075202ee01/68747470733a2f2f706f7365722e707567782e6f72672f756e7265616c34752f6d7174742f762f737461626c65)](https://packagist.org/packages/unreal4u/mqtt)[![Total Downloads](https://camo.githubusercontent.com/ca07d8893a4d4bc5082519e008036b324e734c2d59412a603ce863be8af49e03/68747470733a2f2f706f7365722e707567782e6f72672f756e7265616c34752f6d7174742f646f776e6c6f616473)](https://packagist.org/packages/unreal4u/mqtt)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/45860f31c39041efd473fbb069710450a75aa3767d11cef5e37ca11e143234d6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f756e7265616c34752f6d7174742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/unreal4u/mqtt/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/75744118879ffff1412857ec1edf8a27c69e0db45e863841c0957f7de576b2f5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f756e7265616c34752f6d7174742f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/unreal4u/mqtt/?branch=master)[![Build Status](https://camo.githubusercontent.com/d67d6497425b435553f8dd64dac1815a455641633fdcab07cd6925b94fbd97ef/68747470733a2f2f7472617669732d63692e6f72672f756e7265616c34752f6d7174742e737667)](https://travis-ci.org/unreal4u/mqtt)[![License](https://camo.githubusercontent.com/b0532ada11b95004b2669fd80fe909c0de70257c055fd758843a235e9ffc6252/68747470733a2f2f706f7365722e707567782e6f72672f756e7265616c34752f6d7174742f6c6963656e7365)](https://packagist.org/packages/unreal4u/mqtt)

What is MQTT?
-------------

[](#what-is-mqtt)

Please read the [following wiki page](https://github.com/unreal4u/mqtt/wiki/What-is-MQTT%3F) for that :) Don't forget to read the other articles which may contain more useful information: [What is QoS?](https://github.com/unreal4u/mqtt/wiki/What-is-QoS%3F)
[Difference between QoS and Retainability](https://github.com/unreal4u/mqtt/wiki/Difference-between-retain-and-QoS)
[What is ClientId?](https://github.com/unreal4u/mqtt/wiki/Why-is-the-ClientId-important%3F)

Capabilities of this package:
-----------------------------

[](#capabilities-of-this-package)

This package is able to:

- Connect to the broker. You can connect with virtually all optional parameters the protocol supports, including Will Message. The only exception to the rule is the clean session flag. This is not tested and may or may not work as intended.
- Publish QoS level 0, 1 and 2 messages. All protocol supported parameters are also supported, such as retained messages and other options.
- Subscribe on QoS level 0, 1 and 2 topics. Connection handling will be done automatically, no need to fiddle with PingRequests and alike.
- Filters of topics are those used on the protocol itself, which eliminates the likeliness of bugs that may occur from incorrectly parsing such filters.

This package uses sockets to communicate (a)synchronously with the broker. If you don't want this, you are free to create your own client, for which you'll just have to implement an interface.

Examples
--------

[](#examples)

This package has many examples detailing the many things you can do with it. Please check the [examples directory](https://github.com/unreal4u/mqtt/tree/master/examples) for more information. In case of questions or doubt, [open up an Issue](https://github.com/unreal4u/mqtt/issues/new) or submit a [Pull Request](https://github.com/unreal4u/mqtt/pulls) if you feel the need to clarify, correct or add more examples.

References
==========

[](#references)

**\[mqtt-v3.1.1-plus-errata01\]**

MQTT Version 3.1.1 Plus Errata 01. Edited by Andrew Banks and Rahul Gupta. 10 December 2015. OASIS Standard Incorporating Approved Errata 01. . Latest version: .

**Original library that served as inspiration for this one**[McFizh/libMQTT](https://github.com/McFizh/libMQTT)

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~72 days

Recently: every ~108 days

Total

8

Last Release

2621d ago

Major Versions

v0.3.0 → v1.0.0-alpha2018-03-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/43792f8b224d7de339a848cd799635fa8e062eea3fb669e3ca7a1d1e2cff756d?d=identicon)[unreal4u](/maintainers/unreal4u)

---

Top Contributors

[![unreal4u](https://avatars.githubusercontent.com/u/194999?v=4)](https://github.com/unreal4u "unreal4u (126 commits)")

---

Tags

apimqttphpphp7phpapimqtt

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/unreal4u-mqtt/health.svg)

```
[![Health](https://phpackages.com/badges/unreal4u-mqtt/health.svg)](https://phpackages.com/packages/unreal4u-mqtt)
```

###  Alternatives

[jstolpe/instagram-graph-api-php-sdk

Instagram Graph API PHP SDK

138110.7k2](/packages/jstolpe-instagram-graph-api-php-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
