Examples on how to use the swoole async PHP framework
serve-file
: server a file using the correct mimetypeclient
: make an async call to an external domain and download the pagechannel
: share memory and data between coroutinesprocess
: load an external program and run it multiple processesrouter
: use an off-the-rack router (nikic/fast-route) to route request methods and URIswebsocket
: a chat example with websocketsslim
: an example of how to use the Slim Frameworkevent-source
: (incomplete) an example of the EventSource long-lived connection
Take a look inside docker-compose.yml
and uncomment the example you want to run.
composer install
docker-compose up
When modifying files, you need to restart the docker instance to see the changes. This is because the files are loaded into Swooles memory and therefore cannot be modified after the server is started. You may be familiar with this workflow if you developed anything using Node.js.