Open Swoole (since 2017) v4.8.0 following with v4.8.1 is released with support for PHP 8.1, native PostgreSQL coroutine client support, a major Swoole Table bug fixed and multiple new features. This is the first major release to support PHP 8.1 stable released.
Open Swoole v4.8.0 has been tested with the Official PHP8.1.0 released. If you like to use PHP 8.1, please upgrade to v4.8.1 now.
In the previous version, you have to install another extension ext-postgresql to use PostgreSQL client with coroutines.
In the future versions >= 4.8.0, you can comiple OpenSwoole with PostgreSQL enabled using new option:
You can find the docs for the PostgreSQL client at https://openswoole.com/docs/modules/swoole-coroutine-postgres.
There was a major table bug fixed in this release that caused data loss in the previous versions. It is recommended to upgrade if you like to use Swoole Table as data storage and not just K-V cache.
In the previous version, you may also lose data silently if the table size is too small. We have improved here to throw exceptions in this case.
To improve the reliability of the Open Swoole server, a new server configuration option is added to limit the request execution time:
The default value is 0, so you can keep the default value if you don't like to enable this feature.
You can find details at the Swoole Server configuration docs.
There are multiple fixes and improvements about the type system, improved type hinting of OpenSwoole for PHP version >= 8.0.
You can enable consistent type checking if it is activated in the PHP code directly at the beginning of each file:
It is recommended to enable strict type checking for all the modern PHP projects. You can find more details about this at Type Hinting Support in PHP 8.
You have to run all your unit tests when enabling strict type checking to avoid unexpected BC breaks.
The Open Swoole Team has started working on cleaning up outdated API and fixing the API consistency. We have added deprecation notices to a few classes which will be removed in future versions. Please check the Open Swoole docs about how to use alternative API.
We have improved the CI system and provided a few unofficial Docker images for PHP, you can use them when your CI system is relying on and the Official PHP Docker images are not available:
docker run openswoole/php:7.2 docker run openswoole/php:7.3 docker run openswoole/php:7.4 docker run openswoole/php:8.0 docker run openswoole/php:8.1
You can find OpenSwoole Docker images at: https://hub.docker.com/r/openswoole/swoole. The OpenSwoole Docker images are only available when the Official PHP Docker images are released.
You may run into issues when installing on macOS in the previous version. There is an improvement to automatically find OpenSSL when you enable OpenSSL in OpenSwoole.
We will drop the support for outdated PHP versions: PHP7.2 & PHP7.3 based on community feedback in the near future, so upgrade as soon as possible if you can.
We will provide more pre-build packages such as OpenSwoole for Ubuntu/Debian, AWS EC2 along with yum packages avaiable at Remi's RPM repository. You can follow the progress at https://github.com/openswoole/swoole-src/issues/79.
Thanks to all the contributors for this release, the kind support from community and team members working behind the scene.
You can report bugs and submit features reqeust at https://github.com/openswoole/swoole-src/issues.
- PHP 8.1 support - Native support for Postgres coroutine client, enable --with-postgres[=DIR] - New HTTP server option: max_request_execution_time - Support strict type hinting and fix the type of arguments, return value - Bug fixed: data loss bug in Swoole table - Bug fixed: compile issues when enabling OpenSSL on macOS - Throw \Swoole\Exception when Swoole table is too small to avoid data loss - Deprecation warning added: Swoole\Coroutine\Server - Deprecation warning added: Swoole\Coroutine\Barrier - Deprecation warning added: Swoole\Coroutine\Http\Server - Deprecation warning added: SWOOLE_HOOK_CURL, use SWOOLE_HOOK_NATIVE_CURL
v4.8.1 is a bug fixes release:
- Fix build with postgresql 9 on RHEL - Fix strict data type checking bugs
You can upgrade to Open Swoole v4.8.1 now:
pecl install openswoole
If you need to install Open Swoole or look at other update methods, checkout the installation documentation and how to update Open Swoole.
Join 4,000+ others and never miss out on new tips, tutorials, and more.