PHPackages                             pascalwacker/php-mqtt-client - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. pascalwacker/php-mqtt-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

pascalwacker/php-mqtt-client
============================

MQTT 3.1.1 library for PHP with TLS support

1.0.3(8y ago)238MITPHP

Since Aug 9Pushed 8y ago1 watchersCompare

[ Source](https://github.com/pascalwacker/php-mqtt-client)[ Packagist](https://packagist.org/packages/pascalwacker/php-mqtt-client)[ RSS](/packages/pascalwacker-php-mqtt-client/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)DependenciesVersions (4)Used By (0)

php-mqtt-client
===============

[](#php-mqtt-client)

MQTT 3.1.1 Client with TSL support in PHP

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

Installation
============

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

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

```

or add

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

```

to the require section of your composer.json.

Requirements
============

[](#requirements)

Should work with all recent PHP versions.

Code developed and running in production using PHP v5.6.27

Not tested on PHP v7, please report back!

Basic Usage
===========

[](#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
=======

[](#credits)

Thanks to [bluerhinos/phpMQTT](https://github.com/bluerhinos/phpMQTT) and [McFizh/libMQTT](https://github.com/McFizh/libMQTT).

License
=======

[](#license)

Released under the MIT License. Please see [License File](LICENSE) for more information.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

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 ~62 days

Total

3

Last Release

3078d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/aaad3af4306e5e4de18799640604814326836d5c274bb66a496b51ef9a425a35?d=identicon)[pascalwacker](/maintainers/pascalwacker)

---

Top Contributors

[![karpy47](https://avatars.githubusercontent.com/u/8948719?v=4)](https://github.com/karpy47 "karpy47 (11 commits)")

---

Tags

phpclientmqtt

### Embed Badge

![Health badge](/badges/pascalwacker-php-mqtt-client/health.svg)

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

###  Alternatives

[simps/mqtt

MQTT Protocol Analysis and Coroutine Client for PHP

39351.6k9](/packages/simps-mqtt)[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4540.0k](/packages/ismaeltoe-osms)[ebics-api/ebics-client-php

PHP library to communicate with bank through EBICS protocol.

6411.1k](/packages/ebics-api-ebics-client-php)[wormling/phparia

Asterisk REST Interface (ARI) client for PHP.

419.8k](/packages/wormling-phparia)

PHPackages © 2026

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