Slim Framework + Swoole project boilerplate
This package is auto-updated.
Last update: 2022-07-28 14:42:49 UTC
Start your new project with composer:
$ composer create-project skoro/slim-swoole-project <project-path>
cd <project-path> to project directory.
The default settings are good enough but if you need to customize them you have to start with copying stock settings:
$ cp .env.example .env
Then you can start the http server by running this command:
$ composer run server
It will listen to
9501 port if you left
SERVER_PORT environment variables by default.
When you need to stop or restart the server by an external command
kill you also can use a pid file which is located in
Please keep in mind, changing your project source code won't be
applied automatically, you need to restart the server manually.
To make life easier, you could enable
DEBUG=true mode in your
.env and the server
will restart automatically depending on the project source code
changes but this feature requires
inotify extension to be installed.
Instead of editing your
.env you could start the server like this:
$ composer run server-debug
You should also pay attention xdebug is not compatible with Swoole (https://openswoole.com/docs/get-started/common-install-errors#trying-to-use-xdebug-and-swoole).
This project uses PHP-DI container implementation.
The container itself and its dependencies are configured in
file. Keep in mind, you can use any psr-11
compatible container, so it's up to you which container to use.