phasync / swerve
快速高效地将您的长时间运行的PHP应用程序从CLI中(s)swerve。
dev-main
2024-07-13 01:00 UTC
Requires
- charm/http: ^2.0
- charm/terminal: ^1.1.5
- nyholm/psr7: ^1.8
- phasync/phasync: ^1.1.0-rc0
- phasync/server: ^1.0
- psr/http-message: ^1.0 | ^2.0
- psr/log: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: dev-master
- slim/psr7: ^1.7
- slim/slim: ^4.14
This package is auto-updated.
Last update: 2024-09-13 01:17:59 UTC
README
早期演示版发布,预计会有BUG
入门指南
- 在您的应用程序根目录中创建一个名为
swerve.php
的文件。此文件必须返回一个PSR-15 RequestHandlerInterface。例如
<?php use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use Slim\Factory\AppFactory; $app = AppFactory::create(); $app->get('/', function (RequestInterface $request, ResponseInterface $response) { $response->getBody()->write('Hello, World'); return $response; }); return $app;
-
安装
swerve
:composer require phasync/swerve
-
运行
./vendor/bin/swerve
来启动Web服务器。
用法
> ./vendor/bin/swerve --help [ SWERVE ] Swerving your website... >>> WARNING! THIS IS BETA SOFTWARE FOR PREVIEW ONLY <<< Usage: swerve [-mdhvq] [-w,--workers=<processes>] [--fastcgi=<ip:port>] [--http=<ip:port>] [--https=<ip:port>] [--log=<path>] [swerve.php] -m,--monitor Monitor source code and reload automatically -d Run as daemon -w,--workers=<processes> Number of worker processes (default: auto) --fastcgi=<ip:port> IP and port for FastCGI server --http=<ip:port> IP and port for HTTP server (default: 127.0.0.1:8080) --https=<ip:port> IP and port for HTTPS server --log=<path> Log errors to file -h,--help Display this help message -v,--verbose Increase logging verbosity, repeat for higher verbosity -q,--quiet Suppress all output [swerve.php] Full path to application php file