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 4y 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 yesterday

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 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity29

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

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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