Stars: 211
Forks: 53
Pull Requests: 135
Issues: 20
Watchers: 30
Last Updated: 2022-12-16 04:10:09
📚 Swoole Library
License: Apache License 2.0
Languages: PHP, Dockerfile, Shell
Just open new pull requests (and we need unit tests for new features)
First, you need to build the base image:
docker compose build imageThen run the following command to autoload PHP classes/files (no extra Composer packages to be installed):
docker compose run --rm composer installSecondly, run the next command to start Docker containers:
docker compose upAlternatively, if you need to rebuild the service(s) and to restart the containers:
docker compose build image --no-cache
docker compose up --force-recreateNow you can create an app's bash session:
docker compose exec app bashAnd run commands inside the container:
composer testOr you can tell to run it directly:
docker compose exec app composer testOnce you have Docker containers started (as discussed in previous section), you can use commands like following to run examples under folder examples.
docker compose exec app php examples/mysqli/base.php
docker compose exec app php examples/pdo/base.php
docker compose exec app php examples/redis/base.phpThere is a fantastic example showing how to use Swoole as a proxy to serve a WordPress website using PHP-FPM. Just open URL http://127.0.0.1 in the browser and check what you see there. Source code of the example can be found here.
Here are some more examples to make FastCGI calls to PHP-FPM:
docker compose exec app php examples/fastcgi/greeter/call.php
docker compose exec app php examples/fastcgi/greeter/client.php
docker compose exec app php examples/fastcgi/proxy/base.php
docker compose exec app php examples/fastcgi/var/client.phpdefine('SWOOLE_USE_SHORTNAME', true); // or false (it depends on you)To update Composer packages (optional):
docker compose run --rm composer updateTo check coding standard violations:
docker compose run --rm composer cs-checkTo correct coding standard violations automatically:
docker compose run --rm composer cs-fixHere are all the third party libraries used in this project:
You can find the licensing information of these third party libraries here.
This project follows the Apache 2 license.