PHPackages                             toxmc/fast-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. toxmc/fast-laravel

ActiveLibrary[HTTP &amp; Networking](/categories/http)

toxmc/fast-laravel
==================

High performance HTTP server based on Swoole. Make your Laravel applications fast.

v1.0.4(4y ago)33689MITPHPPHP ^7.1CI failing

Since Sep 25Pushed 4y ago2 watchersCompare

[ Source](https://github.com/toxmc/fast-laravel)[ Packagist](https://packagist.org/packages/toxmc/fast-laravel)[ RSS](/packages/toxmc-fast-laravel/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (12)Versions (7)Used By (0)

中文 | [English](./README_EN.md)

简介
--

[](#简介)

```
  ___                   _                             _
 / __)          _      | |                           | |
| |__ ____  ___| |_    | | ____  ____ ____ _   _ ____| |
|  __) _  |/___)  _)   | |/ _  |/ ___) _  | | | / _  ) |
| | ( ( | |___ | |__   | ( ( | | |  ( ( | |\ V ( (/ /| |
|_|  \_||_(___/ \___)  |_|\_||_|_|   \_||_| \_/ \____)_|

```

> 🚀[fast-laravel](https://packagist.org/packages/toxmc/fast-laravel). 是基于 [Swoole](https://https://github.com/swoole/swoole-src) 实现的高性能、常驻内存的 `laravel` 框架 `composer` 扩展包， 性能较传统基于 `PHP-FPM` 的服务有质的提升，提供超高性能的同时，也保持着 `Laravel`框架的优点。基本上无需变更业务代码的前提下即可使原有项目蜕变为常驻内存服务从而提升响应速度。 扩展提供了 `热加载`、`异步任务`、`Crontab 秒级定时任务`、`性能分析工具`、`自定义进程` 等非常便捷的功能，满足丰富的技术场景和业务场景，开箱即用。

扩展初衷
----

[](#扩展初衷)

`Laravel` 是优雅的 `PHP Web` 开发框架。具有高效、简洁、富于表达力等优点。采用 `MVC` 设计， 是崇尚开发效率的全栈框架。是最受关注的 `PHP` 框架。然而 `Laravel` 最为人诟病的缺点就是：**慢、笨重**。 如何改变这种情况？ 实际项目中也遇到接口响应速度不理想，加机器、加缓存、`OPcache`、升级`PHP7`都做了， 还是不理想，还能进一步吗？考虑到各种成本。换 `go` 语言还是换基于 `swoole` 的协程框架。 考虑到业务量，重写业务成本过高。于是 `fast-laravel`诞生了。

服务器要求
-----

[](#服务器要求)

`Fast-Laravel` 基于 `swoole` 的所以对系统环境有一些要求，仅可运行于 `Linux` 和 `Mac` 环境下， 但由于 `Docker` 虚拟化技术的发展，在 `Windows` 下也可以通过 `Docker for Windows` 来作为运行环境。 以及 `Windows` 下子系统的发展 `WSL` 也是不错的选择，推荐 `Ubuntu`。

Docker
------

[](#docker)

[dockerfiles](https://github.com/toxmc/fast-laravel/tree/master/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     6.89ms   14.42ms 318.44ms   94.69%
    Req/Sec     0.97k   233.68     2.33k    74.63%
  232532 requests in 30.09s, 52.34MB read
Requests/sec:   7727.54
Transfer/sec:      1.74MB

```

当您不想采用 Docker 来作为运行的环境基础时，您需要确保您的运行环境达到了以下的要求：

- PHP &gt;= 7.1
- Swoole PHP 扩展 &gt;= 4.0
- JSON PHP 扩展
- MongoDB PHP 扩展 （性能分析tracker使用）
- tideways\_xhprof 或 tideways PHP 扩展 （性能分析tracker使用）

安装 Fast-Laravel
---------------

[](#安装-fast-laravel)

Fast-Laravel 使用 [Composer](https://getcomposer.org) 来管理项目的依赖，在使用 Fast-Laravel 之前， 请确保你的运行环境已经安装好了 Composer。通过 `Composer` 安装。

1. 安装 `fast-laravel````
    composer require toxmc/fast-laravel -vvv

    ```
2. 发布配置信息 ```
    php artisan vendor:publish --tag=fast-laravel

    ```

    或者 ```
    php artisan http publish

    ```
3. 生成 `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 publishconfig生成fast命令所需的配置
原理：复制一份fast启动所需的配置到json文件中.
主要为了解决config和route重载不生效的问题。php artisan http configinfos查看服务信息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:startstop停止服务php fast http:stoprestart重启服务php fast http:restartreload重载服务php fast http:reloadinfos查看服务信息php fast http:infossupervisor 管理服务
---------------

[](#supervisor-管理服务)

例举MAC下安装

```
brew install supervisor

```

启动

```
supervisord -c supervisor/supervisor.conf

```

管理

```
[xmc@mc fast-laravel (master ✗)]$ supervisorctl -c supervisor/supervisor.conf
fast-laravel-monitor             RUNNING   pid 18131, uptime 0:03:11

supervisor> help

default commands (type help ):
=====================================
add    exit      open  reload  restart   start   tail
avail  fg        pid   remove  shutdown  status  update
clear  maintail  quit  reread  signal    stop    version

supervisor> status
fast-laravel-monitor             RUNNING   pid 29146, uptime 3:03:36

```

热重载
---

[](#热重载)

> 建议生产环境关闭该服务。仅限开发时使用。

- `hot_reload`： 是否开启热重载
- `hot_reload_type`： 热重载类型，支持 `inotify` 和 `tick`
    - `inotify` 依赖 `inotify PHP` 扩展
    - `tick` 是利用 `swoole` 定时器，定时检测文件是否变化，进而进行 `reload` 操作
- `hot_reload_paths`： 监控的文件变更目录。只要属于目录内的文件，发生变动，就会进行 `reload`

```
    'server'    => [
        'hot_reload'          => env('SWOOLE_HOT_RELOAD', false),
        'hot_reload_type'     => env('SWOOLE_HOT_RELOAD_TYPE', ''),// inotify or tick
        'hot_reload_paths'    => [
            base_path('app'),
            base_path('config'),
        ],
    ]

```

2：fswatch

```
brew install fswatch

[xmc@mc fast-laravel (master ✗)]$ sh fswatch.sh /Users/xmc/PhpstormProjects/iizhu/api
Starting fswatch...
File /Users/xmc/PhpstormProjects/iizhu/api/app/Service/TestService.php has been modified.
Reloading swoole_http_server...
> success
File /Users/xmc/PhpstormProjects/iizhu/api/app/Service/TestService.php has been modified.
Reloading swoole_http_server...
> success

```

#### Alternative

[](#alternative)

- [laravel-swoole](https://github.com/swooletw/laravel-swoole)

#### Alternative Framework

[](#alternative-framework)

- [Swoft](https://www.swoft.org/)
- [easyswoole](http://www.easyswoole.com/)
- [hyperf](http://www.hyperf.io/)

#### Others

[](#others)

- Q群:190349019

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~119 days

Recently: every ~138 days

Total

6

Last Release

1821d ago

Major Versions

v1.0.0 → 6.x-dev2019-11-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/d9fb43a8efc9b85f0c53c1d186dcfe8485eebf660f3c0e1d0a37b2e52f3746bb?d=identicon)[smalleyes](/maintainers/smalleyes)

---

Top Contributors

[![toxmc](https://avatars.githubusercontent.com/u/3990846?v=4)](https://github.com/toxmc "toxmc (58 commits)")

---

Tags

apmcrontabhttplaravelprocessrestart-serverserverswooletabletasktrackerhttplaravelperformanceserverswoole

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/toxmc-fast-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/toxmc-fast-laravel/health.svg)](https://phpackages.com/packages/toxmc-fast-laravel)
```

###  Alternatives

[hhxsv5/laravel-s

🚀 LaravelS is an out-of-the-box adapter between Laravel/Lumen and Swoole.

3.9k676.0k10](/packages/hhxsv5-laravel-s)[huang-yi/shadowfax

Run Laravel on Swoole.

3521.7k](/packages/huang-yi-shadowfax)[dragon-code/laravel-http-logger

Logging incoming HTTP requests

319.8k3](/packages/dragon-code-laravel-http-logger)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[laravel-shift/curl-converter

A command line tool to convert curl requests to Laravel HTTP requests.

935.3k](/packages/laravel-shift-curl-converter)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
