pingyeaa / yii2-mosquitto

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

yii2-mosquitto

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);

About

License:Other


Languages

Language:PHP 100.0%