enochzg/yii2-mosquitto

There is no license information available for the latest version (1.0.5) of this package.

yii2-mosquitto

Installs: 1 068

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 0

Type:yii2-extension

1.0.5 2016-03-19 07:12 UTC

This package is not auto-updated.

Last update: 2024-09-12 00:59:46 UTC


README

Installation

The component is based on php-mosquitto extension. The download link is https://github.com/mgdm/Mosquitto-PHP.

composer require enochzg/yii2-mosquitto

Usage

Add target class in your project config:

'components' => [
    'mosquitto' => [
        'class' => 'enochzg\mosquitto\Mosquitto',
        'host' => '127.0.0.1',
        'port' => '1883',
        'keepalive' => 60,
        'cafile' => '[your/cert/path]/ca.crt',
        'certfile' => '[your/cert/path]/client.crt',
        'keyfile' => '[your/cert/path]/client.key',
    ],
    //......
]

e.g.

yii::$app->mosquitto->publish('1', 'message', 2);