Swoole is an open source, production ready async programming framework for PHP. Compared with other async programming frameworks or softwares such as Nginx, Tornado, Node.js, the framework has the built-in async, multiple threads I/O modules. Developers can use sync or async API to write the applications. Swoole PHP network framework enhances the efficiency of R&D team, enable them to focus on the development of innovative products.

Using this framework developers can create a service per container, and that container can be built with PHP only. Some benchmarks made by Matthew Weier O’Phinney founds that expressive applications performed four times better under this solution than under a traditional nginx+php-fpm pair.

More interesting: when benchmarking with a high number of concurrent requests, we also found that Swoole had fewer failed requests. This means you get both better performance and better resilience!

Some of the features of Swoole :

  • Event-Driven, Asynchronous Programming For PHP
  • IPv4 / IPv6 / Unixsocket / TCP/ UDP And SSL / TLS Support
  • High Performance, Scalable, Support C1000K
  • Async TCP / UDP / HTTP / Websocket / HTTP2 Client/Server Side API
  • Fast Serializer / Unserializer
  • Milliseconds Task Scheduler
  • Daemonize
  • and Open Source !

This will be great for mobile applications, Internet of things, Micro services, Web API Or Apps, Gaming Servers, and live chat systems. It is different from the traditional PHP model, it is running in CLI mode.


The differences between the framework and PHP-FPM the traditional PHP model are:

  • It forks a number of worker processes based on CPU core number to utilize all CPU cores.
  • It supports Long-live connections for websocket server or TCP/UDP server.
  • It supports more server-side protocols.
  • It can manage and reuse the status in memory.

Swoole coroutines :

Swoole Coroutine is similar to Coroutine in the other lanaguge or frameworks. It create one coroutine for each request and schedule based on IO status. It is not necessary to use callback in the server side logic. Coroutines allowing you to write normal, synchronous code that still benefits from the asynchronous nature of the system event loop, allowing your server to continue responding to new requests as they come in!


Swoole is a great alternative to give better performance and reliability to your production grade applications.

More information at https://www.swoole.co.uk/


Please enter your comment!
Please enter your name here