Skip to content

Commit e42348d

Browse files
committed
Refector openswoole
1 parent ff0d4a3 commit e42348d

10 files changed

+503
-469
lines changed

frameworks/PHP/openswoole/README.md

+44-56
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,90 @@
1-
<h1>
2-
<img width="200" height="120" align="center" alt="Open Swoole Logo" src="https://www.swoole.co.uk/images/swoole-logo.svg" />
3-
</h1>
1+
<p align="center"><a href="https://openswoole.com" target="_blank"><img src="https://openswoole.com/images/swoole-logo.svg#gh-light-mode-only" width="200" /></a></p>
42

5-
[![lib-openswoole](https://github.com/openswoole/swoole-src/workflows/lib-openswoole/badge.svg)](https://github.com/openswoole/swoole-src/actions?query=workflow%3Alib-openswoole)
6-
[![ext-openswoole](https://github.com/openswoole/swoole-src/workflows/ext-openswoole/badge.svg)](https://github.com/openswoole/swoole-src/actions?query=workflow%3Aext-openswoole)
7-
[![test-linux](https://github.com/openswoole/swoole-src/workflows/test-linux/badge.svg)](https://github.com/openswoole/swoole-src/actions?query=workflow%3Atest-linux)
8-
[![Coverity Scan Build Status](https://scan.coverity.com/projects/23970/badge.svg)](https://scan.coverity.com/projects/open-swoole-src)
9-
[![codecov](https://codecov.io/gh/openswoole/swoole-src/branch/master/graph/badge.svg)](https://codecov.io/gh/openswoole/swoole-src)
103

11-
**Open Swoole (since 2017) is a programmatic server for PHP with async IO, coroutines and fibers: secure, reliable, high performance**
4+
<p align="center"><a href="https://github.com/openswoole/ext-openswoole/actions?query=workflow%3Alib-openswoole"><img src="https://github.com/openswoole/ext-openswoole/workflows/lib-openswoole/badge.svg" alt="lib-openswoole" style="max-width: 100%;"></a>
5+
<a href="https://github.com/openswoole/ext-openswoole/actions?query=workflow%3Aext-openswoole"><img src="https://github.com/openswoole/ext-openswoole/workflows/ext-openswoole/badge.svg" alt="ext-openswoole" style="max-width: 100%;"></a>
6+
<a href="https://github.com/openswoole/ext-openswoole/actions?query=workflow%3Atest-linux"><img src="https://github.com/openswoole/ext-openswoole/workflows/test-linux/badge.svg" alt="test-linux" style="max-width: 100%;"></a>
7+
<a href="https://scan.coverity.com/projects/open-swoole-src" rel="nofollow"><img src="https://camo.githubusercontent.com/74ce2aa24f7fc272064e7afeec3712e0e548cda19202c4af7e42e7cacf2e7f6f/68747470733a2f2f7363616e2e636f7665726974792e636f6d2f70726f6a656374732f32333937302f62616467652e737667" alt="Coverity Scan Build Status" data-canonical-src="https://scan.coverity.com/projects/23970/badge.svg" style="max-width: 100%;"></a></p>
128

13-
## Documentation & Community
9+
## Open Swoole
1410

15-
+ __Documentation__: <https://www.swoole.co.uk/docs>
11+
Open Swoole is a programmatic server for PHP with async IO, coroutines and fibers: secure, reliable, high performance
12+
13+
+ __Website__: <https://openswoole.com>
1614
+ __Twitter__: <https://twitter.com/openswoole>
17-
+ __Join Slack Group__: <https://goo.gl/forms/wooTTDmhbu30x4qC3>
18-
+ __Join Discord Channel__: <https://discord.gg/5QC57RNPpw>
19-
+ __IDE Helper & API__: <https://github.com/openswoole/ide-helper>
15+
+ __Slack__: <https://goo.gl/forms/wooTTDmhbu30x4qC3>
16+
+ __Discord__: <https://discord.gg/5QC57RNPpw>
17+
+ __IDE Helper__: <https://github.com/openswoole/ide-helper>
2018

21-
## Installation
19+
## Documentation
2220

23-
> As with any open source project, Open Swoole always provides the most reliable stability and the most powerful features in **the latest released version**. Please ensure as much as possible that you are using the latest version.
21+
Documentation for Open Swoole can be found on the [Open Swoole website](https://openswoole.com/docs).
2422

25-
### Compiling requirements
23+
## Installation
2624

27-
+ Linux, OS X or Cygwin, WSL
28-
+ PHP 7.2.0 or later (The higher the version, the better the performance.)
29-
+ GCC 4.8 or later
25+
> Open Swoole always provides the most reliable stability and the most powerful features in **the latest released version**. Please ensure as much as possible that you are using the latest version.
3026
31-
### 1. Install with PECL (beginners)
27+
### 1. Install or upgrade Open Swoole from multiple distribution channels
3228

33-
```shell
34-
pecl install openswoole
35-
```
29+
Please check [Open Swoole Installation Guide](https://openswoole.com/docs/get-started/installation) about how to install Open Swoole on Ubuntu/CentOS/Windows WSL from Docker, PECL or Binary releases channels.
3630

37-
### 2. Install from source (recommended)
31+
### 2. Compile from source
3832

39-
Please download the source packages from [Releases](https://github.com/openswoole/swoole-src/releases) or:
33+
#### Compiling requirements
4034

41-
```shell
42-
git clone https://github.com/openswoole/swoole-src.git && \
43-
cd swoole-src
44-
git checkout v4.8.0
45-
```
35+
+ Linux, OS X or Cygwin, WSL
36+
+ PHP 7.4.0 or later (The higher the version, the better the performance.)
37+
+ GCC 4.8 or later
4638

47-
Compile and install at the source folder:
39+
Download the source packages from [Releases](https://github.com/openswoole/ext-openswoole/releases) or:
4840

4941
```shell
42+
git clone https://github.com/openswoole/ext-openswoole.git && \
43+
cd ext-openswoole
44+
git checkout v22.0.0
5045
phpize && \
5146
./configure && \
5247
make && make install
5348
```
5449

55-
#### Enable extension in PHP
56-
57-
After compiling and installing the openswoole extension, you have to add a new line `extension=openswoole.so` to `php.ini` to enable Open Swoole. It is recommended to be added after all the other extensions because openswoole may depend on extensions: sockets, mysqlnd, curl etc.
50+
You can find how to fix [Common Installation Errors](https://openswoole.com/docs/get-started/common-install-errors) if there are errors in the installation.
5851

59-
#### Extra compile configurations
52+
#### Compile configurations
6053

6154
> for example: `./configure --enable-openssl --enable-sockets`
6255
6356
+ `--enable-openssl` or `--with-openssl-dir=DIR`
6457
+ `--enable-sockets`
6558
+ `--enable-http2`
6659
+ `--enable-mysqlnd` (need mysqlnd, it just for supporting `$mysql->escape` method)
67-
+ `--enable-swoole-json`
68-
+ `--enable-swoole-curl`
60+
+ `--enable-hook-curl`
6961
+ `--with-postgres[=DIR]`
7062

71-
### Upgrade
63+
#### Enable Open Swoole extension
7264

73-
> If you upgrade from source, don't forget to `make clean` before you upgrade your swoole
65+
After compiling and installing the openswoole extension, you have to add a new line `extension=openswoole.so` at the end of `php.ini` or create a ini file at `conf.d` folder to enable Open Swoole. It is recommended to be added after all the other extensions because openswoole may depend on extensions: sockets, mysqlnd, curl etc.
7466

75-
1. `pecl upgrade openswoole`
76-
2. `cd swoole-src && git pull && make clean && make && sudo make install`
77-
3. if you have changed PHP version, please re-run `phpize clean && phpize` then try to compile
67+
## Frameworks & Components
7868

79-
## Call for Contributors
69+
> PR are welcome if your framework is using openswoole
70+
71+
- [**Laravel Octane**](https://laravel.com/docs/9.x/octane) Laravel Octane supercharges your application's performance by serving your application using high-powered application servers.
72+
- [**PHP Runtime**](https://github.com/php-runtime) make it easy to run any kind of PHP Application (Symfony, Laravel, PSR7, Native) with all kinds of Runtimes like OpenSwoole, Bref, Google Cloud Functions, Roadrunner and React PHP with minimal configuration.
73+
- [**Mezzio Swoole**](https://docs.mezzio.dev/mezzio-swoole/) allows you to run Mezzio and [PSR-15](https://www.php-fig.org/psr/psr-15/) applications on Open Swoole.
74+
75+
## For Contributors
8076

8177
If you like to involve the maintenance of this repo, it is better to get started by submitting PR, you will be invited to the dev group once there are significant contributions. Or join Slack group firstly, the team will provide mentoring and internal support to help you get started.
8278

83-
* [Report issues and feedback](https://github.com/openswoole/swoole-src/issues)
79+
* [Report issues and feedback](https://github.com/openswoole/ext-openswoole/issues)
8480
* Submit fixes, features via Pull Request
8581

86-
This project exists thanks to all the historical [[Contributors](https://github.com/openswoole/swoole-src/graphs/contributors)].
82+
This project exists thanks to all the historical [[Contributors](https://github.com/openswoole/ext-openswoole/graphs/contributors)].
8783

8884
## Security issues
8985

90-
Security issues should be reported privately, via email, to the Open Swoole develop team [[email protected]](mailto:[email protected]). You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message.
91-
92-
## Frameworks & Components
93-
94-
> PR are welcome if your framework is using openswoole
95-
96-
- [**Laravel Octane**](https://laravel.com/docs/8.x/octane) Laravel Octane supercharges your application's performance by serving your application using high-powered application servers.
97-
- [**PHP Runtime**](https://github.com/php-runtime) make it easy to run any kind of PHP Application (Symfony, Laravel, PSR7, Native) with all kinds of Runtimes like OpenSwoole, Bref, Google Cloud Functions, Roadrunner and React PHP with minimal configuration.
98-
- [**Mezzio Swoole**](https://docs.mezzio.dev/mezzio-swoole/) allows you to run Mezzio and [PSR-15](https://www.php-fig.org/psr/psr-15/) applications on Open Swoole.
86+
Security issues should be reported privately, via email, to the Open Swoole develop team [[email protected]](mailto:[email protected]). You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message.
9987

10088
## License
10189

102-
Apache License Version 2.0 see http://www.apache.org/licenses/LICENSE-2.0.html
90+
Open Swoole is open-sourced software licensed under the [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0.html).

frameworks/PHP/openswoole/benchmark_config.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
"database": "MySQL",
1515
"framework": "openswoole",
1616
"language": "PHP",
17-
"flavor": "PHP8.1",
17+
"flavor": "PHP8.2",
1818
"orm": "Raw",
1919
"platform": "openswoole",
2020
"webserver": "none",
2121
"os": "Linux",
2222
"database_os": "Linux",
23-
"display_name": "Open Swoole",
23+
"display_name": "openswoole",
2424
"notes": "",
2525
"versus": "php"
2626
},
@@ -35,13 +35,13 @@
3535
"database": "Postgres",
3636
"framework": "openswoole",
3737
"language": "PHP",
38-
"flavor": "PHP8",
38+
"flavor": "PHP8.2",
3939
"orm": "Raw",
4040
"platform": "openswoole",
4141
"webserver": "none",
4242
"os": "Linux",
4343
"database_os": "Linux",
44-
"display_name": "Open Swoole Postgres",
44+
"display_name": "openswoole postgres",
4545
"notes": "",
4646
"versus": "php"
4747
},
@@ -56,13 +56,13 @@
5656
"database": "MySQL",
5757
"framework": "openswoole",
5858
"language": "PHP",
59-
"flavor": "PHP8.1",
59+
"flavor": "PHP8.2",
6060
"orm": "Raw",
6161
"platform": "openswoole",
6262
"webserver": "none",
6363
"os": "Linux",
6464
"database_os": "Linux",
65-
"display_name": "Open Swoole no-async",
65+
"display_name": "openswoole no-async",
6666
"notes": "Without async db pool connection",
6767
"versus": "php"
6868
}
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"require": {
3+
"openswoole/core": "dev-master"
4+
}
5+
}
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
FROM php:8.1-cli
1+
FROM php:8.2-cli
2+
3+
RUN apt-get update && apt-get install -y git > /dev/null
4+
5+
RUN docker-php-ext-install opcache pdo_mysql > /dev/null
26

37
RUN pecl install openswoole > /dev/null && \
48
docker-php-ext-enable openswoole
59

6-
RUN docker-php-ext-install opcache pdo_mysql > /dev/null
10+
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
11+
12+
COPY php.ini /usr/local/etc/php/
713

814
ADD ./ /openswoole
915
WORKDIR /openswoole
1016

11-
COPY php.ini /usr/local/etc/php/
17+
RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
1218

1319
EXPOSE 8080
1420

15-
CMD php swoole-server-noasync.php
21+
CMD php /openswoole/openswoole-server-pdo.php
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
FROM php:8.1-cli
1+
FROM php:8.2-cli
2+
3+
RUN apt-get update && apt-get install -y git > /dev/null
24

35
RUN docker-php-ext-install opcache > /dev/null
46

5-
ENV SWOOLE_VERSION 4.8.0
7+
ENV VERSION 22.0.0
68

79
RUN apt-get update && apt-get install -y libpq-dev \
8-
&& cd /tmp && curl -sSL "https://github.com/openswoole/swoole-src/archive/v${SWOOLE_VERSION}.tar.gz" | tar xzf - \
9-
&& cd swoole-src-${SWOOLE_VERSION} \
10+
&& cd /tmp && curl -sSL "https://github.com/openswoole/ext-openswoole/archive/v${VERSION}.tar.gz" | tar xzf - \
11+
&& cd ext-openswoole-${VERSION} \
1012
&& phpize && ./configure --with-postgres > /dev/null && make > /dev/null && make install > /dev/null \
1113
&& docker-php-ext-enable openswoole
1214

13-
WORKDIR /openswoole
14-
15-
COPY swoole-server.php swoole-server.php
16-
RUN sed -i "s|_postgres||g" swoole-server.php
15+
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
1716

1817
COPY php.ini /usr/local/etc/php/
1918

19+
ADD ./ /openswoole
20+
WORKDIR /openswoole
21+
22+
RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
23+
2024
EXPOSE 8080
2125

22-
CMD php swoole-server.php
26+
CMD php /openswoole/openswoole-server-postgres.php

0 commit comments

Comments
 (0)