-
Notifications
You must be signed in to change notification settings - Fork 9
3.扩展安装
mc² edited this page May 19, 2020
·
1 revision
Fast-Laravel
基于 swoole
的所以对系统环境有一些要求,仅可运行于 Linux
和 Mac
环境下,但由于 Docker
虚拟化技术的发展,在 Windows
下也可以通过 Docker for Windows
来作为运行环境。以及 Windows
下子系统的发展 WSL
也是不错的选择,推荐 Ubuntu
。
dockerfiles 项目内已经为您准备好了。可直接构建运行。
Windows Docker Desktop with WSL1's docker client. Docker Fedora 31, CPUs:4, Memory:4G.
docker build -t=fast-laravel dockerfiles
docker run --rm -p 9100:9100 -d fast-laravel:latest
docker exec -it `docker ps -q` /bin/bash
[root@a26c3596e1b8 www]# wrk -c32 -t8 -d 30s http://127.0.0.1:9100/api/test/info
Running 30s test @ http://127.0.0.1:9100/api/test/info
8 threads and 32 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 7.66ms 14.23ms 312.91ms 93.79%
Req/Sec 775.52 122.16 1.86k 72.42%
185354 requests in 30.06s, 41.72MB read
Requests/sec: 6165.69
Transfer/sec: 1.39MB
当您不想采用 Docker 来作为运行的环境基础时,您需要确保您的运行环境达到了以下的要求:
- PHP >= 7.1
- Swoole PHP 扩展 >= 4.0
- JSON PHP 扩展
- MongoDB PHP 扩展 (性能分析tracker使用)
- tideways_xhprof 或 tideways PHP 扩展 (性能分析tracker使用)
Fast-Laravel 使用 Composer 来管理项目的依赖,在使用 Fast-Laravel 之前,请确保你的运行环境已经安装好了 Composer。
通过 Composer
安装。
- 安装
fast-laravel
composer require toxmc/fast-laravel -vvv
- 发布配置信息
或者
php artisan vendor:publish --tag=fast-laravel
php artisan http publish
- 生成
fast
命令所需的配置(原理复制一份fast-laravel
启动所需的配置到/storage/fast_laravel.json
文件中主要为了解决config
和route
reload
重启不生效的问题)php artisan http config
这样 fast-laravel
扩展就安装完成了。
php artisan http {action : publish|config|infos}.
action | 参数意义 | 命令 |
---|---|---|
publish | 发布配置信息 | php artisan http publish |
config | 生成fast命令所需的配置原理:复制一份fast启动所需的配置到json文件中. 主要为了解决config和route重载不生效的问题。 |
php artisan http config |
infos | 查看服务信息 | php artisan http infos |
php fast http:{action : start|stop|restart|reload|infos}
{-d|--daemon: Whether run as a daemon for start & restart}.
{-a|--access_log: It's will display access log on every request.}.
action | 参数意义 | 命令 |
---|---|---|
start | 启动服务 | php fast http:start |
stop | 停止服务 | php fast http:stop |
restart | 重启服务 | php fast http:restart |
reload | 重载服务 | php fast http:reload |
infos | 查看服务信息 | php fast http:infos |