PHPackages                             alhaji-aki/laravel-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. alhaji-aki/laravel-mqtt-client

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

alhaji-aki/laravel-mqtt-client
==============================

A package to subscribe and publish to mqtt protocols

03PHP

Since May 30Pushed 5y ago1 watchersCompare

[ Source](https://github.com/alhaji-aki/laravel-mqtt-client)[ Packagist](https://packagist.org/packages/alhaji-aki/laravel-mqtt-client)[ RSS](/packages/alhaji-aki-laravel-mqtt-client/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

installation
============

[](#installation)

```
composer require alhaji-aki/laravel-mqtt-client
```

publish config and adds listen command to app

```
php artisan mqtt:install
```

change the logic in the listen command and register it in the Command Kernel

available methods:
==================

[](#available-methods)

### connect to a broker

[](#connect-to-a-broker)

```
MqttClient::connect();
```

### get connection

[](#get-connection)

```
MqttClient::connect()->connection();
```

### disconnect

[](#disconnect)

```
use AlhajiAki\MqttClient\Facades\MqttClient;

$connection = MqttClient::connect()->connection();
$connection->disconnect();
```

### publish

[](#publish)

```
use AlhajiAki\MqttClient\Facades\MqttClient;

$data = [
    'foo' => 'bar',
    'bar' => 'baz',
    'time' => time(),
]

MqttClient::connect()->publish('foo/bar', json_encode($data), 0);
```

### subscribe

[](#subscribe)

```
use AlhajiAki\MqttClient\Facades\MqttClient;
use Morbo\React\Mqtt\Packets\Publish;

MqttClient::connect()->subscribe('foo/bar', function ($stream) {
    $stream->on(Publish::EVENT, function (Publish $message) {
        printf(
            'Received payload "%s" for topic "%s"%s',
            $message->getPayload(),
            $message->getTopic(),
            PHP_EOL
        );
    });
}, 0);
```

unsubscribe

```
use AlhajiAki\MqttClient\Facades\MqttClient;

MqttClient::connect()->unsubscribe('foo/bar', function ($message) {
    printf(
        'Received payload "%s" for topic "%s"%s',
        $message->getPayload(),
        PHP_EOL
    );
}, function ($ex) {
    printf('Error occured: %s', $ex->getMessage());
});
```

###  Health Score

16

—

LowBetter than 4% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19788708?v=4)[Abdul Kudus](/maintainers/alhaji-aki)[@alhaji-aki](https://github.com/alhaji-aki)

---

Top Contributors

[![alhaji-aki](https://avatars.githubusercontent.com/u/19788708?v=4)](https://github.com/alhaji-aki "alhaji-aki (6 commits)")

### Embed Badge

![Health badge](/badges/alhaji-aki-laravel-mqtt-client/health.svg)

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

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M82](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M91](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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