Install Swoft
Docker installation (recommended)
docker run -p 18306:18306 --name swoft swoft/swoft
Docker-Compose installation (recommended)
git clone https://github.com/swoft-cloud/swoft
cd swoft
docker-compose up
prompt
docker-compose up
after the start, the default startup swoft http server, and it is the first process container ( pid=1
), therefore there is no way to enter the container stop / restart the server.
If you want to enter the container after booting, manually manage the startup of the swoft server. You need to adjust the docker-compose.yml
slightly:
swoft:
image: swoft/swoft
# for local develop
command: php -S 127.0.0.1:13300
Add a commad command to override the default startup server command. After booting, enter the container and manually start the server php bin/swoft http:start
.
At this point, the server process is not the first process of the container, you can use the other commands of the swowt server to stop / restart operations.
Composer installation
composer create-project swoft/swoft swoft
Accelerate domestic download speeds with
Packagist国内镜像
, see Composer configuration
Manual installation
git clone https://github.com/swoft-cloud/swoft
cd swoft
composer install --no-dev # 不安装 dev 依赖会更快一些
cp .env.example .env
vim .env # 根据需要调整启动参数
Use Sofftcli
For the swoftcli tool, check out the swowtcli documentation . Support for quickly creating a clean swowt app from different template projects
php swoftcli.phar create:app --type full YOUR_APP_NAME
php swoftcli.phar create:app --type ws YOUR_APP_NAME
php swoftcli.phar create:app --type tcp YOUR_APP_NAME