Skip to content

farzai/laravel-mqtt-channel

Repository files navigation

Laravel MQTT Broadcast Channel

(Work in progress) Please note that this package is still under development and is not ready for production use.

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status codecov Total Downloads

This package provides an MQTT broadcast channel for Laravel applications. It uses the MQTT protocol to enable real-time broadcasting of events in your Laravel application to MQTT clients.

Features

  • Send MQTT messages from your Laravel application
  • Broadcast Laravel events over MQTT

Installation

You can install the package via composer:

composer require farzai/laravel-mqtt-channel

You can publish the config file with:

php artisan vendor:publish --tag="laravel-mqtt-channel-config"

This is the contents of the published config file:

return [
    'default' => env('MQTT_CONNECTION', 'default'),

    'connections' => [
        'default' => [
            'host' => env('MQTT_HOST'),
            'port' => env('MQTT_PORT', 1883),
            'username' => env('MQTT_USERNAME'),
            'password' => env('MQTT_PASSWORD'),
        ],
    ],
];

Usage

use Farzai\MqttBroadcastChannel\MQTTChannel;

class ExampleNotification extends Notification
{
    use Queueable;

    public function via($notifiable)
    {
        return [MQTTChannel::class];
    }

    public function toMQTT($notifiable)
    {
        return [
            'topic' => 'topic',
            'message' => 'message',
        ];
    }
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

MQTT broadcast channel for Laravel applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages