Skip to content

Commit e3723cf

Browse files
authored
Merge pull request #144 from mairo744/feature/remove-open-swoole
feat!: drop Open Swoole support and require Swoole extension only
2 parents 89d74b5 + 19b9bed commit e3723cf

File tree

9 files changed

+22
-63
lines changed

9 files changed

+22
-63
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
>
2121
> You trust us enough to use our software. We ask that you trust us to say the truth on this. We need your help. Go out and protest this unnecessary war. Stop the bloodshed. Say "stop the war!"
2222
23-
This library provides support for [Swoole](https://github.com/swoole/swoole-src) or [Open Swoole](https://www.swoole.co.uk/) for [Mezzio](https://docs.mezzio.dev/) applications.
23+
This library provides the support of [Swoole](https://github.com/swoole/swoole-src) into an [Mezzio](https://docs.mezzio.dev/) application.
2424
This means you can execute your Mezzio application using Swoole directly from the command line.
2525

2626
## Installation

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"laminas",
77
"mezzio",
88
"components",
9-
"openswoole",
109
"swoole",
1110
"psr-7",
1211
"psr-14",
@@ -36,6 +35,9 @@
3635
},
3736
"require": {
3837
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
38+
"ext-intl": "*",
39+
"ext-swoole": "^6.0",
40+
"ext-zlib": "*",
3941
"dflydev/fig-cookies": "^2.0.1 || ^3.0",
4042
"laminas/laminas-cli": "^1.8",
4143
"laminas/laminas-diactoros": "^2.25.2 || ^3.0",
@@ -60,9 +62,7 @@
6062
"vimeo/psalm": "^5.19"
6163
},
6264
"suggest": {
63-
"ext-inotify": "To use inotify based file watcher. Required for hot code reloading.",
64-
"ext-openswoole": "The package requires at least one of Open Swoole or Swoole",
65-
"ext-swoole": "The package requires at least one of Open Swoole or Swoole"
65+
"ext-inotify": "To use inotify based file watcher. Required for hot code reloading."
6666
},
6767
"autoload": {
6868
"psr-4": {

composer.lock

Lines changed: 11 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/book/v4/intro.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
# Swoole
22

3-
[Open Swoole](https://www.swoole.co.uk/) is a PECL extension for developing asynchronous applications in PHP.
3+
[Swoole](https://wiki.swoole.com/) is a PECL extension for developing asynchronous applications in PHP.
44
It enables PHP developers to write high-performance, scalable, concurrent TCP, UDP, Unix socket, HTTP, or Websocket services without requiring in-depth knowledge about non-blocking I/O programming or the low-level Linux kernel.
55

66
## Install swoole
77

8-
You can install the Open Swoole extension on Linux or Mac environments using the following commands:
8+
You can install the Swoole extension on Linux or Mac environments using the following commands:
99

1010
```bash
11-
$ pecl install openswoole
11+
$ pecl install swoole
1212
```
1313

14-
For more information on the extension, [visit its package details on PECL](https://pecl.php.net/package/openswoole).
15-
16-
> ### Legacy Swoole compatibility
17-
>
18-
> Since version 3.4.0, mezzio-swoole can work with either the original [Swoole](https://github.com/swoole/swoole-src) extension or the new community Open Swoole extension, as each defines the same classes, interfaces, and constants consumed by mezzio-swoole.
14+
For more information on the extension, [visit its package details on PECL](https://pecl.php.net/package/swoole).
1915

2016
## Install mezzio-swoole
2117

@@ -27,7 +23,7 @@ $ composer require mezzio/mezzio-swoole
2723

2824
## Swoole with Mezzio
2925

30-
mezzio-swoole enables an Mezzio application to be executed with the [Open Swoole](https://www.swoole.co.uk/) or original [Swoole](https://github.com/swoole/swoole-src) extensions.
26+
mezzio-swoole enables an Mezzio application to be executed with the [Swoole](https://github.com/swoole/swoole-src) extension.
3127
This means you can run the application from the command line, **without requiring a web server**.
3228

3329
You can run the application using the following command:

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<phpunit
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5-
bootstrap="test/bootstrap.php"
5+
bootstrap="vendor/autoload.php"
66
cacheDirectory=".phpunit.cache"
77
displayDetailsOnIncompleteTests="true"
88
displayDetailsOnSkippedTests="true"

src/ConfigProvider.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
use Mezzio\Swoole\Event\WorkerStartEvent;
3838
use Mezzio\Swoole\Event\WorkerStartListener;
3939
use Mezzio\Swoole\Event\WorkerStartListenerFactory;
40-
use Mezzio\Swoole\Exception\ExtensionNotLoadedException;
4140
use Mezzio\Swoole\HotCodeReload\FileWatcher\InotifyFileWatcher;
4241
use Mezzio\Swoole\HotCodeReload\FileWatcherInterface;
4342
use Mezzio\Swoole\Log\AccessLogFactory;
@@ -53,7 +52,6 @@
5352
use Psr\Http\Message\ServerRequestInterface;
5453
use Swoole\Http\Server as SwooleHttpServer;
5554

56-
use function extension_loaded;
5755
use function getcwd;
5856

5957
use const PHP_SAPI;
@@ -69,14 +67,6 @@ class ConfigProvider
6967
{
7068
public function __invoke(): array
7169
{
72-
if (! extension_loaded('swoole') && ! extension_loaded('openswoole')) {
73-
throw new ExtensionNotLoadedException(
74-
'One of either the Swoole (https://github.com/swoole/swoole-src) or'
75-
. ' Open Swoole (https://www.swoole.co.uk) extensions must be loaded'
76-
. ' to use mezzio/mezzio-swoole'
77-
);
78-
}
79-
8070
$config = PHP_SAPI === 'cli'
8171
? ['dependencies' => $this->getDependencies()]
8272
: [];

src/SwooleEmitter.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Psr\Http\Message\ResponseInterface;
1515
use Swoole\Http\Response as SwooleHttpResponse;
1616

17-
use function extension_loaded;
1817
use function implode;
1918
use function substr;
2019

@@ -40,10 +39,6 @@ public function __construct(private SwooleHttpResponse $swooleResponse)
4039
*/
4140
public function emit(ResponseInterface $response): bool
4241
{
43-
if (! extension_loaded('swoole') && ! extension_loaded('openswoole')) {
44-
return false;
45-
}
46-
4742
if (PHP_SAPI !== 'cli') {
4843
return false;
4944
}

test/SwooleStreamTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use RuntimeException;
1616
use Swoole\Http\Request as SwooleHttpRequest;
1717

18-
use function extension_loaded;
1918
use function strlen;
2019
use function substr;
2120

@@ -36,10 +35,6 @@ class SwooleStreamTest extends TestCase
3635

3736
protected function setUp(): void
3837
{
39-
if (! extension_loaded('swoole')) {
40-
$this->markTestSkipped('The Swoole extension is not available');
41-
}
42-
4338
$this->request = $this->createMock(SwooleHttpRequest::class);
4439
$this->request
4540
->method('rawContent')

test/bootstrap.php

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)