Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
d5ded08f5e | |||
dfa86d9dc8 | |||
0100c86442 | |||
bbaff88e41 | |||
42227c7e56 | |||
30040e8503 | |||
68c11c6b4a | |||
b059586d08 | |||
0669643386 | |||
936ce0549d | |||
c42ec1d6ff |
6
.github/workflows/tests.yml
vendored
6
.github/workflows/tests.yml
vendored
@ -15,9 +15,9 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php-version: ['7.4', '8.0', '8.1']
|
||||
php-version: ['7.4', '8.0', '8.1', '8.2']
|
||||
include:
|
||||
- php-version: '8.1'
|
||||
- php-version: '8.2'
|
||||
run-sonarqube-analysis: true
|
||||
|
||||
steps:
|
||||
@ -41,7 +41,7 @@ jobs:
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
run: |
|
||||
echo "::set-output name=dir::$(composer config cache-files-dir)"
|
||||
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache Composer dependencies
|
||||
uses: actions/cache@v3
|
||||
|
@ -1,4 +1,4 @@
|
||||
# php-mqtt/laravel-client
|
||||
# ykxiao/laravel-mqtt-client
|
||||
|
||||
[](https://packagist.org/packages/php-mqtt/laravel-client)
|
||||
[](https://packagist.org/packages/php-mqtt/laravel-client)
|
||||
@ -16,10 +16,10 @@ allows you to connect to an MQTT broker where you can publish messages and subsc
|
||||
|
||||
## Installation
|
||||
|
||||
The package is available on [packagist.org](https://packagist.org/packages/php-mqtt/laravel-client) and can be installed using composer:
|
||||
The package is available on [packagist.org](https://packagist.org/packages/ykxiao/laravel-mqtt-client) and can be installed using composer:
|
||||
|
||||
```bash
|
||||
composer require php-mqtt/laravel-client
|
||||
composer require ykxiao/laravel-mqtt-client
|
||||
```
|
||||
|
||||
The package will register itself through Laravel auto discovery of packages.
|
||||
|
@ -1,52 +1,52 @@
|
||||
{
|
||||
"name": "php-mqtt/laravel-client",
|
||||
"description": "A wrapper for the php-mqtt/client library for Laravel.",
|
||||
"type": "library",
|
||||
"keywords": [
|
||||
"mqtt",
|
||||
"client",
|
||||
"publish",
|
||||
"subscribe",
|
||||
"laravel"
|
||||
],
|
||||
"homepage": "https://github.com/php-mqtt/laravel-client",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marvin Mall",
|
||||
"email": "marvin-mall@msn.com",
|
||||
"role": "developer"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.4|^8.0",
|
||||
"illuminate/config": "~7.0|~8.0|~9.0",
|
||||
"illuminate/support": "~7.0|~8.0|~9.0",
|
||||
"php-mqtt/client": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"squizlabs/php_codesniffer": "^3.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PhpMqtt\\Client\\": "src"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"PhpMqtt\\Client\\MqttClientServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"MQTT": "PhpMqtt\\Client\\Facades\\MQTT"
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"fix:cs": "vendor/bin/phpcbf",
|
||||
"test": [
|
||||
"@test:cs"
|
||||
"name": "ykxiao/laravel-mqtt-client",
|
||||
"description": "A wrapper for the ykxiao/laravel-mqtt-client library for Laravel.",
|
||||
"type": "library",
|
||||
"keywords": [
|
||||
"mqtt",
|
||||
"client",
|
||||
"publish",
|
||||
"subscribe",
|
||||
"laravel"
|
||||
],
|
||||
"test:cs": "vendor/bin/phpcs"
|
||||
}
|
||||
"homepage": "https://git.tool.dwoodauto.com/ykxiao/laravel-matt-client",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Marvin Mall",
|
||||
"email": "marvin-mall@msn.com",
|
||||
"role": "developer"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.4|^8.0",
|
||||
"illuminate/config": "^7.0|^8.0|^9.0|^10.0",
|
||||
"illuminate/support": "^7.0|^8.0|^9.0|^10.0",
|
||||
"php-mqtt/client": "^1.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"squizlabs/php_codesniffer": "^3.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PhpMqtt\\Client\\": "src"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"PhpMqtt\\Client\\MqttClientServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"MQTT": "PhpMqtt\\Client\\Facades\\MQTT"
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"fix:cs": "vendor/bin/phpcbf",
|
||||
"test": [
|
||||
"@test:cs"
|
||||
],
|
||||
"test:cs": "vendor/bin/phpcs"
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,10 @@ return [
|
||||
// with the log level as configured.
|
||||
'enable_logging' => env('MQTT_ENABLE_LOGGING', true),
|
||||
|
||||
// Which logging channel to use for logs produced by the MQTT client.
|
||||
// If left empty, the default log channel or stack is being used.
|
||||
'log_channel' => env('MQTT_LOG_CHANNEL', null),
|
||||
|
||||
// Defines which repository implementation shall be used. Currently,
|
||||
// only a MemoryRepository is supported.
|
||||
'repository' => MemoryRepository::class,
|
||||
|
@ -139,11 +139,16 @@ class ConnectionManager
|
||||
$cleanSession = (bool) Arr::get($config, 'use_clean_session', true);
|
||||
$repository = Arr::get($config, 'repository', Repository::class);
|
||||
$loggingEnabled = (bool) Arr::get($config, 'enable_logging', true);
|
||||
$logChannel = Arr::get($config, 'log_channel', null);
|
||||
|
||||
$settings = $this->buildConnectionSettings(Arr::get($config, 'connection_settings', []));
|
||||
$repository = $this->application->make($repository);
|
||||
$logger = $loggingEnabled ? $this->application->make('log') : null;
|
||||
|
||||
if ($logger && $logChannel) {
|
||||
$logger = $logger->channel($logChannel);
|
||||
}
|
||||
|
||||
$client = new MqttClient($host, $port, $clientId, $protocol, $repository, $logger);
|
||||
$client->connect($settings, $cleanSession);
|
||||
|
||||
|
Reference in New Issue
Block a user