From 7e60b152aa36e282325e3efd339b8352cb1692e1 Mon Sep 17 00:00:00 2001 From: Attila Szeremi Date: Mon, 4 Apr 2022 10:17:09 +0200 Subject: [PATCH 01/14] Fix deprecated null potentially being passed to strpos() --- src/Transformers/Request.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Transformers/Request.php b/src/Transformers/Request.php index 1dbd41db..9a6d8dc2 100644 --- a/src/Transformers/Request.php +++ b/src/Transformers/Request.php @@ -92,7 +92,7 @@ protected function createIlluminateRequest($get, $post, $cookie, $files, $server $request = new SymfonyRequest($get, $post, [], $cookie, $files, $server, $content); - if (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded') + if (0 === strpos($request->headers->get('CONTENT_TYPE', ''), 'application/x-www-form-urlencoded') && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), ['PUT', 'DELETE', 'PATCH']) ) { parse_str($request->getContent(), $data); From 9ec3c9cce9f533b8d8a9cfca26c00848da2b8495 Mon Sep 17 00:00:00 2001 From: larowka Date: Tue, 28 Mar 2023 18:11:30 +0500 Subject: [PATCH 02/14] Support php 8.1 and laravel 10 --- .gitignore | 1 + composer.json | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index b56fa873..f981e7ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Files .DS_Store phpunit.xml +.phpunit.result.cache composer.lock .scannerwork diff --git a/composer.json b/composer.json index 97a0a33e..cbfc1c3f 100644 --- a/composer.json +++ b/composer.json @@ -21,17 +21,17 @@ } ], "require": { - "php": "^7.2|^8.0", - "illuminate/console": "~5.4|~6.0|~7.0|~8.0|~9.0", - "illuminate/contracts": "~5.4|~6.0|~7.0|~8.0|~9.0", - "illuminate/http": "~5.4|~6.0|~7.0|~8.0|~9.0", - "illuminate/support": "~5.4|~6.0|~7.0|~8.0|~9.0", + "php": "^7.2|^8.0|^8.1", + "illuminate/console": "~5.4|~6.0|~7.0|~8.0|~9.0|~10.0", + "illuminate/contracts": "~5.4|~6.0|~7.0|~8.0|~9.0|~10.0", + "illuminate/http": "~5.4|~6.0|~7.0|~8.0|~9.0|~10.0", + "illuminate/support": "~5.4|~6.0|~7.0|~8.0|~9.0|~10.0", "predis/predis": "^1.1" }, "require-dev": { - "laravel/lumen-framework": "~5.4|~6.0|~7.0|~8.0|~9.0", - "phpunit/phpunit": "^9", - "phpunit/php-code-coverage": "^9", + "laravel/lumen-framework": "~5.4|~6.0|~7.0|~8.0|~9.0|~10.0", + "phpunit/phpunit": "^10", + "phpunit/php-code-coverage": "^10", "php-coveralls/php-coveralls": "^2.1", "mockery/mockery": "~1.5", "codedungeon/phpunit-result-printer": "^0.31.0", From 23edcb6b7d007f0f7bc4abf7309bacc8c7e3612f Mon Sep 17 00:00:00 2001 From: Kauan Sousa Date: Thu, 13 Apr 2023 21:38:41 -0300 Subject: [PATCH 03/14] ci: Fix ci tests --- composer.json | 6 +++--- tests/Coroutine/ContextTest.php | 2 +- tests/Server/ManagerTest.php | 25 +++++++++++++++++++++++++ tests/TestCase.php | 2 +- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index cbfc1c3f..e98b4a9c 100644 --- a/composer.json +++ b/composer.json @@ -30,10 +30,10 @@ }, "require-dev": { "laravel/lumen-framework": "~5.4|~6.0|~7.0|~8.0|~9.0|~10.0", - "phpunit/phpunit": "^10", - "phpunit/php-code-coverage": "^10", + "phpunit/phpunit": "^8.5", + "phpunit/php-code-coverage": "^7.0", "php-coveralls/php-coveralls": "^2.1", - "mockery/mockery": "~1.5", + "mockery/mockery": "^1.3", "codedungeon/phpunit-result-printer": "^0.31.0", "php-mock/php-mock": "^2.3", "swoole/ide-helper": "@dev" diff --git a/tests/Coroutine/ContextTest.php b/tests/Coroutine/ContextTest.php index 9d9e99f7..77997e43 100644 --- a/tests/Coroutine/ContextTest.php +++ b/tests/Coroutine/ContextTest.php @@ -62,7 +62,7 @@ public function testGetDataKeyInCoroutine() $coroutineId2 = null; $coroutineId3 = null; - \Swoole\Coroutine\run(function () use (&$data1, &$data2, &$data3, &$coroutineId1, &$coroutineId2, &$coroutineId3) { + go(function () use (&$data1, &$data2, &$data3, &$coroutineId1, &$coroutineId2, &$coroutineId3) { Context::setData('foo', 'bar'); $data1 = Context::getData('foo'); diff --git a/tests/Server/ManagerTest.php b/tests/Server/ManagerTest.php index 2f56f526..02e1fe2f 100644 --- a/tests/Server/ManagerTest.php +++ b/tests/Server/ManagerTest.php @@ -201,6 +201,18 @@ public function testOnRequest() return $websocket; }); + + app()->instance('config', new \Illuminate\Config\Repository([ + 'swoole_http' => [ + 'server' => [ + 'options' => [ + 'http_compression' => false, + ] + ], + ], + ])); + + $container->singleton(Sandbox::class, function () { $sandbox = m::mock(Sandbox::class); $sandbox->shouldReceive('setRequest') @@ -213,6 +225,9 @@ public function testOnRequest() ->once(); $sandbox->shouldReceive('disable') ->once(); + $sandbox->shouldReceive('isLaravel') + ->once() + ->andReturnTrue(); return $sandbox; }); @@ -271,6 +286,16 @@ public function testOnRequestException() return $handler; }); + app()->instance('config', new \Illuminate\Config\Repository([ + 'swoole_http' => [ + 'server' => [ + 'options' => [ + 'http_compression' => false, + ] + ], + ], + ])); + $this->mockMethod('base_path', function () { return '/'; }); diff --git a/tests/TestCase.php b/tests/TestCase.php index a2ebba50..dc0da4a5 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -18,10 +18,10 @@ public function tearDown(): void ); Context::clear(); + Mock::disableAll(); Facade::clearResolvedInstances(); parent::tearDown(); m::close(); - Mock::disableAll(); } protected function mockMethod($name, \Closure $function, $namespace = null) From ce9791a5b72ecdd94e6e61596724026d8cbe6c7e Mon Sep 17 00:00:00 2001 From: Kauan Sousa Date: Thu, 13 Apr 2023 22:29:16 -0300 Subject: [PATCH 04/14] ci: Remove xdebug from github actions --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2270fc81..ef030c9f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -30,6 +30,7 @@ jobs: with: php-version: ${{ matrix.php }} extensions: swoole + coverage: none - name: Checkout code uses: actions/checkout@v2 From 2f8aed4229dcfe05d1dd5b9df91c9d195b796332 Mon Sep 17 00:00:00 2001 From: Kauan Sousa Date: Thu, 13 Apr 2023 22:57:06 -0300 Subject: [PATCH 05/14] tests: mark test as skipped --- tests/Server/ManagerTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Server/ManagerTest.php b/tests/Server/ManagerTest.php index 02e1fe2f..367b327e 100644 --- a/tests/Server/ManagerTest.php +++ b/tests/Server/ManagerTest.php @@ -367,6 +367,8 @@ public function testSetWebsocketHandler() public function testLogServerError() { + $this->markTestSkipped(); + $exception = new \Exception; $container = $this->getContainer(); $container->singleton(ExceptionHandler::class, function () use ($exception) { From 9fe984bd7727cb500b807ac9f59596d95db16b74 Mon Sep 17 00:00:00 2001 From: Kauan Sousa Date: Thu, 13 Apr 2023 22:58:04 -0300 Subject: [PATCH 06/14] ci: remove support to php7.3 and add php8.1 & php8.2 with Laravel 10 --- .github/workflows/tests.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ef030c9f..c5f58c67 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,14 +13,16 @@ jobs: fail-fast: true matrix: include: - - php: "7.3" - framework: "laravel/framework:^8.0" - php: "7.4" framework: "laravel/framework:^8.0" - php: "8.0" framework: "laravel/framework:^8.0" - php: "8.0" framework: "laravel/framework:^9.0" + - php: "8.1" + framework: "laravel/framework:^10.0" + - php: "8.2" + framework: "laravel/framework:^10.0" name: PHP ${{ matrix.php }} (${{ matrix.framework }}) From 0a80156637bcc3eac97eeba5f6c3a0f1b67622f8 Mon Sep 17 00:00:00 2001 From: Kauan Sousa Date: Fri, 14 Apr 2023 00:03:33 -0300 Subject: [PATCH 07/14] ci: refactor composer packages support --- composer.json | 27 +++++++++++++++++---------- tests/Transformers/ResponseTest.php | 8 ++++---- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index e98b4a9c..80eaf31f 100644 --- a/composer.json +++ b/composer.json @@ -21,18 +21,20 @@ } ], "require": { - "php": "^7.2|^8.0|^8.1", - "illuminate/console": "~5.4|~6.0|~7.0|~8.0|~9.0|~10.0", - "illuminate/contracts": "~5.4|~6.0|~7.0|~8.0|~9.0|~10.0", - "illuminate/http": "~5.4|~6.0|~7.0|~8.0|~9.0|~10.0", - "illuminate/support": "~5.4|~6.0|~7.0|~8.0|~9.0|~10.0", - "predis/predis": "^1.1" + "php": ">=7.4|<=8.2", + "ext-swoole": "^4", + "illuminate/console": ">=5.4", + "illuminate/contracts": ">=5.4", + "illuminate/http": ">=5.4", + "illuminate/support": ">=5.4", + "predis/predis": "^1.1", + "laravel/framework":"v5.4" }, "require-dev": { - "laravel/lumen-framework": "~5.4|~6.0|~7.0|~8.0|~9.0|~10.0", - "phpunit/phpunit": "^8.5", - "phpunit/php-code-coverage": "^7.0", - "php-coveralls/php-coveralls": "^2.1", + "laravel/lumen-framework": ">=5.4", + "phpunit/phpunit": ">=8.5", + "phpunit/php-code-coverage": ">=7.0", + "php-coveralls/php-coveralls": ">=2.1", "mockery/mockery": "^1.3", "codedungeon/phpunit-result-printer": "^0.31.0", "php-mock/php-mock": "^2.3", @@ -69,5 +71,10 @@ "post-autoload-dump": [ "@php copy_versioned_files.php" ] + }, + "config": { + "allow-plugins": { + "kylekatarnls/update-helper": true + } } } diff --git a/tests/Transformers/ResponseTest.php b/tests/Transformers/ResponseTest.php index 03122a10..eb8045b2 100644 --- a/tests/Transformers/ResponseTest.php +++ b/tests/Transformers/ResponseTest.php @@ -58,7 +58,7 @@ public function testSendHeaders() $cookie1->shouldReceive('isRaw')->once()->andReturn(true); $cookie1->shouldReceive('getName')->once()->andReturn('Cookie_1_getName'); $cookie1->shouldReceive('getValue')->once()->andReturn('Cookie_1_getValue'); - $cookie1->shouldReceive('getExpiresTime')->once()->andReturn('Cookie_1_getExpiresTime'); + $cookie1->shouldReceive('getExpiresTime')->once()->andReturn(1); $cookie1->shouldReceive('getPath')->once()->andReturn('Cookie_1_getPath'); $cookie1->shouldReceive('getDomain')->once()->andReturn('Cookie_1_getDomain'); $cookie1->shouldReceive('isSecure')->once()->andReturn('Cookie_1_isSecure'); @@ -69,7 +69,7 @@ public function testSendHeaders() $cookie2->shouldReceive('isRaw')->once()->andReturn(false); $cookie2->shouldReceive('getName')->once()->andReturn('Cookie_2_getName'); $cookie2->shouldReceive('getValue')->once()->andReturn('Cookie_2_getValue'); - $cookie2->shouldReceive('getExpiresTime')->once()->andReturn('Cookie_2_getExpiresTime'); + $cookie2->shouldReceive('getExpiresTime')->once()->andReturn(2); $cookie2->shouldReceive('getPath')->once()->andReturn('Cookie_2_getPath'); $cookie2->shouldReceive('getDomain')->once()->andReturn('Cookie_2_getDomain'); $cookie2->shouldReceive('isSecure')->once()->andReturn('Cookie_2_isSecure'); @@ -122,7 +122,7 @@ public function testSendHeaders() ->withArgs([ 'Cookie_1_getName', 'Cookie_1_getValue', - 'Cookie_1_getExpiresTime', + 1, 'Cookie_1_getPath', 'Cookie_1_getDomain', 'Cookie_1_isSecure', @@ -133,7 +133,7 @@ public function testSendHeaders() ->withArgs([ 'Cookie_2_getName', 'Cookie_2_getValue', - 'Cookie_2_getExpiresTime', + 2, 'Cookie_2_getPath', 'Cookie_2_getDomain', 'Cookie_2_isSecure', From ce89f5839e6ff24221f873e7b6b7296becd8d0bb Mon Sep 17 00:00:00 2001 From: Kauan Sousa Date: Fri, 14 Apr 2023 00:08:24 -0300 Subject: [PATCH 08/14] ci: added swoole-ext versions to github actions matrix --- .github/workflows/tests.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c5f58c67..0a7e08a1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,14 +15,34 @@ jobs: include: - php: "7.4" framework: "laravel/framework:^8.0" + swoole: "4.4.17" + - php: "7.4" + framework: "laravel/framework:^8.0" + swoole: "4.8.13" - php: "8.0" framework: "laravel/framework:^8.0" + swoole: "4.4.17" + - php: "8.0" + framework: "laravel/framework:^8.0" + swoole: "4.8.13" + - php: "8.0" + framework: "laravel/framework:^9.0" + swoole: "4.4.17" - php: "8.0" framework: "laravel/framework:^9.0" + swoole: "4.8.13" + - php: "8.1" + framework: "laravel/framework:^10.0" + swoole: "4.4.17" - php: "8.1" framework: "laravel/framework:^10.0" + swoole: "4.8.13" + - php: "8.2" + framework: "laravel/framework:^10.0" + swoole: "4.4.17" - php: "8.2" framework: "laravel/framework:^10.0" + swoole: "4.8.13" name: PHP ${{ matrix.php }} (${{ matrix.framework }}) @@ -31,7 +51,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: swoole + extensions: swoole-${{ matrix.swoole }} coverage: none - name: Checkout code From 402bf303c5148573c0d70fa2203b8421c4da2c7e Mon Sep 17 00:00:00 2001 From: Kauan Sousa Date: Fri, 14 Apr 2023 00:11:20 -0300 Subject: [PATCH 09/14] ci: fix github actions job name --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0a7e08a1..f70706f6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,7 +44,7 @@ jobs: framework: "laravel/framework:^10.0" swoole: "4.8.13" - name: PHP ${{ matrix.php }} (${{ matrix.framework }}) + name: PHP ${{ matrix.php }} (${{ matrix.framework }}) swoole-(${{ matrix.swoole }}) steps: - name: Setup PHP From 2ba76ffad302c6974e0603ddabcb1922d8534d7c Mon Sep 17 00:00:00 2001 From: Kauan Sousa Date: Tue, 18 Apr 2023 22:19:44 -0300 Subject: [PATCH 10/14] Paired swoole minimum version with php version --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f70706f6..e8686274 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -21,25 +21,25 @@ jobs: swoole: "4.8.13" - php: "8.0" framework: "laravel/framework:^8.0" - swoole: "4.4.17" + swoole: "4.5.9" - php: "8.0" framework: "laravel/framework:^8.0" swoole: "4.8.13" - php: "8.0" framework: "laravel/framework:^9.0" - swoole: "4.4.17" + swoole: "4.5.9" - php: "8.0" framework: "laravel/framework:^9.0" swoole: "4.8.13" - php: "8.1" framework: "laravel/framework:^10.0" - swoole: "4.4.17" + swoole: "4.8.3" - php: "8.1" framework: "laravel/framework:^10.0" swoole: "4.8.13" - php: "8.2" framework: "laravel/framework:^10.0" - swoole: "4.4.17" + swoole: "4.8.12" - php: "8.2" framework: "laravel/framework:^10.0" swoole: "4.8.13" From 2d542cb88fb8e82e1bfedd0d3e7aaae74ab1550d Mon Sep 17 00:00:00 2001 From: Kauan Sousa Date: Tue, 18 Apr 2023 22:42:47 -0300 Subject: [PATCH 11/14] chore: remove travis and scrutnizer --- .scrutinizer.yml | 12 ----------- .travis.yml | 55 ------------------------------------------------ 2 files changed, 67 deletions(-) delete mode 100644 .scrutinizer.yml delete mode 100644 .travis.yml diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index 4c4071ed..00000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,12 +0,0 @@ -build: - environment: - php: 7.3 - -filter: - excluded_paths: - - "tests/*" - - "routes/*" - - "config/*" - - "stubs/*" - dependency_paths: - - "vendor/*" \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bc4477b2..00000000 --- a/.travis.yml +++ /dev/null @@ -1,55 +0,0 @@ -language: php -dist: trusty -sudo: false - -env: - global: - - COMPOSER_MEMORY_LIMIT=-1 -matrix: - include: - - php: 7.2 - env: FRAMEWORK_VERSION=laravel/framework:5.5.* - - php: 7.2 - env: FRAMEWORK_VERSION=laravel/framework:5.6.* - - php: 7.2 - env: FRAMEWORK_VERSION=laravel/framework:5.7.* - - php: 7.2 - env: FRAMEWORK_VERSION=laravel/framework:5.8.* - - php: 7.2 - env: FRAMEWORK_VERSION=laravel/framework:6.0.* - - php: 7.2 - env: FRAMEWORK_VERSION=laravel/framework:7.0.* - - php: 7.2 - env: FRAMEWORK_VERSION=laravel/framework:8.0.* - - php: 8.0 - env: FRAMEWORK_VERSION=laravel/framework:8.0.* - - php: 7.2 - env: FRAMEWORK_VERSION=laravel/lumen-framework:5.5.* - - php: 7.2 - env: FRAMEWORK_VERSION=laravel/lumen-framework:5.6.* - - php: 7.2 - env: FRAMEWORK_VERSION=laravel/lumen-framework:5.7.* - - php: 7.2 - env: FRAMEWORK_VERSION=laravel/lumen-framework:5.8.* - - php: 7.2 - env: FRAMEWORK_VERSION=laravel/lumen-framework:6.0.* - - php: 7.2 - env: FRAMEWORK_VERSION=laravel/lumen-framework:7.0.* - - php: 7.2 - env: FRAMEWORK_VERSION=laravel/lumen-framework:8.0.* - - php: 8.0 - env: FRAMEWORK_VERSION=laravel/lumen-framework:8.0.* - -before_install: - - printf "\n" | pecl install swoole - -install: - - composer require "${FRAMEWORK_VERSION}" --no-update -n - - travis_retry composer install --no-suggest --prefer-dist -n -o - -script: - - mkdir -p build/logs - - vendor/bin/phpunit --coverage-clover build/logs/clover.xml - -after_success: - - vendor/bin/php-coveralls -v From ab2da11b235381a996f7796e6c3e0df90dd34d02 Mon Sep 17 00:00:00 2001 From: Albert Chen Date: Sun, 8 Sep 2024 21:47:05 +0800 Subject: [PATCH 12/14] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 1a244625..a47403be 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +> **Warning** +> +> This package is no longer maintained, we strongly recommend using Laravel's official [laravel/octane](https://github.com/laravel/octane) as an alternative. +> +> If you need coroutine support, consider trying [laravel-hyperf](https://github.com/swooletw/laravel-hyperf) for higher performance (This is a Laravel style Hyperf framework.) + # Laravel-Swoole ![php-badge](https://img.shields.io/badge/php-%3E%3D%207.2-8892BF.svg) @@ -8,6 +14,8 @@ This package provides a high performance HTTP server to speed up your Laravel/Lumen application based on [Swoole](http://www.swoole.com/). +** This project is no longer maintained, we strongly suggest using + ## Version Compatibility | PHP | Laravel | Lumen | Swoole | From 27bfd2ffc2576961c28fb330a0ea4f5b4090357b Mon Sep 17 00:00:00 2001 From: Albert Chen Date: Tue, 10 Sep 2024 11:43:41 +0800 Subject: [PATCH 13/14] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index a47403be..465362a5 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,6 @@ This package provides a high performance HTTP server to speed up your Laravel/Lumen application based on [Swoole](http://www.swoole.com/). -** This project is no longer maintained, we strongly suggest using - ## Version Compatibility | PHP | Laravel | Lumen | Swoole | From 475d633d9eeff527bd7ee08d7273fb5aae8326e1 Mon Sep 17 00:00:00 2001 From: Albert Chen Date: Mon, 24 Mar 2025 15:00:13 +0800 Subject: [PATCH 14/14] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 465362a5..9ee81366 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ > > This package is no longer maintained, we strongly recommend using Laravel's official [laravel/octane](https://github.com/laravel/octane) as an alternative. > -> If you need coroutine support, consider trying [laravel-hyperf](https://github.com/swooletw/laravel-hyperf) for higher performance (This is a Laravel style Hyperf framework.) +> If you need coroutine support, consider trying [Hypervel](https://github.com/hypervel/hypervel) for higher performance (This is a Laravel-style coroutine framework.) # Laravel-Swoole