Get Started with Swoole

The swoole is released as a PHP extension (PECL) and run as a PHP cli.

Try it with Docker

Please check the Try Swoole with Docker


Please check the prerequisites and installation guide.

Hello world

An example of a web server written with Swoole which responds 'Hello World':

$http = new swoole_http_server("", 9501);

$http->on('start', function ($server) {
    echo "Swoole http server is started at\n";

$http->on('request', function ($request, $response) {
    $response->header("Content-Type", "text/plain");
    $response->end("Hello World\n");


To run the server, put the code into a file named server.php and execute it in the cli mode of php:

$ php server.php
$ curl

Interested with Swoole? Get Started with Swoole now!