diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml
index bcebbf6..e011290 100644
--- a/.github/workflows/phpstan.yml
+++ b/.github/workflows/phpstan.yml
@@ -4,19 +4,22 @@ on:
push:
pull_request:
+concurrency:
+ group: phpstan-${{ github.ref }}
+ cancel-in-progress: true
+
jobs:
tests:
name: PHP${{ matrix.php-version }} Static Code Analysis on Linux
- runs-on: "${{ matrix.os }}"
+ runs-on: ubuntu-latest
strategy:
matrix:
- os: [ ubuntu-latest ]
- php-version: [ '7.2', '7.3', '7.4', '8.0', '8.1' ]
+ php-version: [ '8.0', '8.1', '8.2', '8.3', '8.4' ]
max-parallel: 5
fail-fast: false
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
@@ -27,10 +30,10 @@ jobs:
- name: Setup Dependencies
env:
- COMPOSER_ROOT_VERSION: 1.4-dev
+ COMPOSER_ROOT_VERSION: 1.x-dev
run:
composer install -o
- name: Run Analysis
- run: |
+ run:
composer analyse
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 35f4eb0..ebdf88e 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -2,110 +2,46 @@ name: PHPUnit for MQTT
on:
push:
+ branches:
+ - master
+ - ci
pull_request:
+ branches:
+ - master
schedule:
- cron: '11 2 * * 1'
-jobs:
- linux:
- name: PHP${{ matrix.php-version }} Swoole-${{ matrix.swoole-version }} Test on Linux
- runs-on: "${{ matrix.os }}"
- strategy:
- matrix:
- os: [ubuntu-latest]
- php-version: ['7.2', '7.3', '7.4', '8.0']
- swoole-version: ['v4.4.26', 'v4.5.11', 'v4.6.7', 'v4.7.1', 'v4.8.7', 'master']
- exclude:
- - php-version: '8.0'
- swoole-version: 'v4.4.26'
- - php-version: '7.2'
- swoole-version: 'master'
- - php-version: '7.3'
- swoole-version: 'master'
- - php-version: '7.4'
- swoole-version: 'master'
- include:
- - os: ubuntu-latest
- php-version: '8.1'
- swoole-version: 'master'
- - os: ubuntu-latest
- php-version: '8.1'
- swoole-version: 'v4.8.7'
- max-parallel: 15
- fail-fast: false
- env:
- SWOOLE_VERSION: ${{ matrix.swoole-version }}
- steps:
- - name: Checkout
- uses: actions/checkout@v2
+concurrency:
+ group: test-${{ github.ref }}
+ cancel-in-progress: true
- - name: Setup PHP
- uses: shivammathur/setup-php@v2
- with:
- php-version: ${{ matrix.php-version }}
- tools: phpize
- ini-values: extension=swoole
- coverage: none
-
- - name: Build Swoole
- run: |
- wget https://github.com/swoole/swoole-src/archive/${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz
- mkdir -p swoole
- tar -xf swoole.tar.gz -C swoole --strip-components=1
- rm swoole.tar.gz
- cd swoole
- phpize
- ./configure --enable-openssl --enable-mysqlnd --enable-http2
- make -j$(nproc)
- sudo make install
- php --ri swoole
-
- - name: Setup Dependencies
- env:
- COMPOSER_ROOT_VERSION: 1.4-dev
- run:
- composer install -o
-
- - name: Coding Standards Check
- if: matrix.php-version != '8.1'
- run: |
- composer cs-check
-
- - name: Run Test Cases
- run: |
- composer test
-
- macos:
- name: PHP${{ matrix.php-version }} Swoole-${{ matrix.swoole-version }} Test on macOS
- runs-on: "${{ matrix.os }}"
+jobs:
+ test:
+ name: PHP${{ matrix.php-version }} Swoole-${{ matrix.swoole-version }} Test on ${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
strategy:
matrix:
- os: [macos-latest]
- php-version: ['7.2', '7.3', '7.4', '8.0']
- swoole-version: ['v4.4.26', 'v4.5.11', 'v4.6.7', 'v4.7.1', 'v4.8.7', 'master']
+ os: [ubuntu-latest, macos-latest]
+ php-version: [ '8.0', '8.1', '8.2', '8.3', '8.4' ]
+ swoole-version: [ 'v4.8.13', 'v5.1.6', 'v6.0.0', 'master' ]
exclude:
+ - php-version: '8.4'
+ swoole-version: 'v5.1.6'
+ - php-version: '8.4'
+ swoole-version: 'v4.8.13'
+ - php-version: '8.3'
+ swoole-version: 'v4.8.13'
+ - php-version: '8.0'
+ swoole-version: 'v6.0.0'
- php-version: '8.0'
- swoole-version: 'v4.4.26'
- - php-version: '7.2'
- swoole-version: 'master'
- - php-version: '7.3'
- swoole-version: 'master'
- - php-version: '7.4'
- swoole-version: 'master'
- include:
- - os: macos-latest
- php-version: '8.1'
swoole-version: 'master'
- - os: macos-latest
- php-version: '8.1'
- swoole-version: 'v4.8.7'
- max-parallel: 15
+ max-parallel: 10
fail-fast: false
env:
SWOOLE_VERSION: ${{ matrix.swoole-version }}
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
@@ -115,35 +51,41 @@ jobs:
ini-values: extension=swoole
coverage: none
- - name: Install Swoole Dependencies
- run: |
- brew install openssl
- brew link openssl
-
- name: Build Swoole
run: |
- wget https://github.com/swoole/swoole-src/archive/${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz
- mkdir -p swoole
- tar -xf swoole.tar.gz -C swoole --strip-components=1
- rm swoole.tar.gz
- cd swoole
- phpize
- ./configure --enable-openssl --with-openssl-dir=/usr/local/opt/openssl@1.1 --enable-mysqlnd --enable-http2
- make -j$(sysctl -n hw.logicalcpu)
- sudo make install
- php --ri swoole
+ if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
+ wget https://github.com/swoole/swoole-src/archive/${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz
+ mkdir -p swoole
+ tar -xf swoole.tar.gz -C swoole --strip-components=1
+ rm swoole.tar.gz
+ cd swoole
+ phpize
+ ./configure --enable-openssl --enable-http2
+ make -j$(nproc)
+ sudo make install
+ php --ri swoole
+ else
+ export CPPFLAGS="$CPPFLAGS -I$(brew --prefix pcre2)/include -L$(brew --prefix pcre2)/lib"
+ wget https://github.com/swoole/swoole-src/archive/${SWOOLE_VERSION}.tar.gz -O swoole.tar.gz
+ mkdir -p swoole
+ tar -xf swoole.tar.gz -C swoole --strip-components=1
+ rm swoole.tar.gz
+ cd swoole
+ phpize
+ ./configure --enable-openssl --with-openssl-dir=$(brew --prefix openssl) --enable-http2
+ make -j$(sysctl -n hw.logicalcpu)
+ sudo make install
+ php --ri swoole
+ fi
- name: Setup Dependencies
env:
- COMPOSER_ROOT_VERSION: 1.4-dev
- run:
- composer install -o
+ COMPOSER_ROOT_VERSION: 1.x-dev
+ run: composer install -o
- name: Coding Standards Check
- if: matrix.php-version != '8.1'
- run: |
- composer cs-check
+ if: matrix.php-version == '8.1'
+ run: composer cs-check
- name: Run Test Cases
- run: |
- composer test
+ run: composer test
diff --git a/README-CN.md b/README-CN.md
index 89b77af..1f0ab9f 100644
--- a/README-CN.md
+++ b/README-CN.md
@@ -17,7 +17,7 @@
[](https://github.com/simps/mqtt/actions)
[](https://github.com/simps/mqtt/actions/workflows/phpstan.yml)
[](https://gitee.com/phpmqtt/mqtt/stargazers)
-[](https://shang.qq.com/wpa/qunwpa?idkey=587be6cdd66b437f2306b1a6d7263fd8096b70ef1db716a259485219f28d41a3)
+[](https://go.qq52o.me/qm/mqtt)
## 安装
diff --git a/README.md b/README.md
index 89bc593..cbac750 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@ Support for `QoS 0`, `QoS 1`, `QoS 2`.
[](https://github.com/simps/mqtt/actions)
[](https://github.com/simps/mqtt/actions/workflows/phpstan.yml)
[](https://gitee.com/phpmqtt/mqtt/stargazers)
-[](https://shang.qq.com/wpa/qunwpa?idkey=587be6cdd66b437f2306b1a6d7263fd8096b70ef1db716a259485219f28d41a3)
+[](https://go.qq52o.me/qm/mqtt)
## Install
diff --git a/bin/copyright-code b/bin/copyright-code
new file mode 100755
index 0000000..c94c239
--- /dev/null
+++ b/bin/copyright-code
@@ -0,0 +1,47 @@
+#!/usr/bin/env php
+in(dirname(__DIR__))
+ ->exclude(['bin', 'docs', 'tests', 'examples'])
+ ->ignoreDotFiles(true)
+ ->ignoreVCSIgnored(true)
+ ->notName(['test.php', 'code.txt'])
+ ->name('*.php')
+ ->sortByName()
+ ->files();
+
+file_put_contents('code.txt', '');
+
+foreach ($files as $file) {
+ file_put_contents('code.txt', removeCommentsAndEmptyLines($file), FILE_APPEND);
+}
+
+function removeCommentsAndEmptyLines($filePath)
+{
+ $cleanCode = '';
+ $fileLines = file($filePath);
+
+ foreach ($fileLines as $line) {
+ $trimmedLine = trim($line);
+
+ // Skip comment lines
+ if (strpos($trimmedLine, '//') === 0 || strpos($trimmedLine, '/*') === 0 || strpos(
+ $trimmedLine,
+ '*'
+ ) === 0 || strpos($trimmedLine, '*/') === 0) {
+ continue;
+ }
+
+ // Skip empty lines
+ if ($trimmedLine !== '') {
+ $cleanCode .= $line;
+ }
+ }
+
+ return $cleanCode;
+}
diff --git a/bin/gen-property b/bin/gen-property
new file mode 100644
index 0000000..0ce9946
--- /dev/null
+++ b/bin/gen-property
@@ -0,0 +1,49 @@
+#!/usr/bin/env php
+getConstants();
+}
+
+function genData(array $constants, string $prefix = '')
+{
+ $data = '';
+ foreach ($constants as $name => $value) {
+ $value = strtolower($name);
+ $data .= "public const {$name} = '{$value}';\n\n";
+ }
+
+ return $data;
+}
+
+$constants = '
+ *
+ * For the full copyright and license information,
+ * please view the LICENSE file that was distributed with this source code.
+ */
+namespace Simps\\MQTT\\Constant;
+
+class Property
+{
+%s
+}
+';
+
+$propertyConstants = getConstants(Property::class);
+$constants = sprintf($constants, genData($propertyConstants));
+
+file_put_contents('src/Constant/Property.php', $constants);
diff --git a/composer.json b/composer.json
index a1299df..600f7e3 100644
--- a/composer.json
+++ b/composer.json
@@ -55,7 +55,7 @@
},
"extra": {
"branch-alias": {
- "dev-master": "1.4-dev"
+ "dev-master": "1.x-dev"
}
}
}
diff --git a/docs/_coverpage.md b/docs/_coverpage.md
index ac3f262..e64f1c8 100644
--- a/docs/_coverpage.md
+++ b/docs/_coverpage.md
@@ -1,4 +1,4 @@
-
+
# PHP MQTT
diff --git a/docs/index.html b/docs/index.html
index 1367ff4..25bed47 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -7,7 +7,7 @@
-
+