PHPackages                             gw123/laravel-swoole - 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. [Framework](/categories/framework)
4. /
5. gw123/laravel-swoole

ActiveLibrary[Framework](/categories/framework)

gw123/laravel-swoole
====================

fast you laravel

v1.5(8y ago)241MITPHP

Since Apr 25Pushed 8y ago1 watchersCompare

[ Source](https://github.com/gw123/laravel-swoole)[ Packagist](https://packagist.org/packages/gw123/laravel-swoole)[ RSS](/packages/gw123-laravel-swoole/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (6)Used By (0)

[![image](https://github.com/gw123/laravel-swoole/raw/master/smallApi.png?raw=true)](https://github.com/gw123/laravel-swoole/blob/master/smallApi.png?raw=true)![Latest Version](https://camo.githubusercontent.com/176e2984dcba6b3944d025bbc8dbc66020ad9e3407a34d8d7a0dc6b35f128725/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f756e737461626c652d76312e302d79656c6c6f772e7376673f6d61784167653d32353932303030)![Php Version](https://camo.githubusercontent.com/5127919eba34cfd4efa2e1d76a62f25de4061ec0a31a434fd9b23f6b16fc2c0e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d372e302d627269676874677265656e2e7376673f6d61784167653d32353932303030)

目录说明
====

[](#目录说明)

[![image](https://github.com/gw123/laravel-swoole/raw/master/%E6%A1%86%E6%9E%B6%E8%AF%B4%E6%98%8E%E5%9B%BE.png?raw=true)](https://github.com/gw123/laravel-swoole/blob/master/%E6%A1%86%E6%9E%B6%E8%AF%B4%E6%98%8E%E5%9B%BE.png?raw=true)

使用swoole加速laravel ,原有的项目代码无需变动! 原有的项目代码无需变动! 原有的项目代码无需变动!!!

- 使用swoole加速laravel
- 实现websocket和http会话同步机制 ，在websocket断线重连后可以方便的恢复原来的会话

安装
==

[](#安装)

- 直接 composer require gw123/laravel-swoole
- 修改根目录下的脚本文件 smallApi 修改为自己的安装位置

```
prefix=/data/wwwroot/laravelTest  #项目安装目录
php_bin=/data/install/php/bin/php #php执行文件位置
app_entry=${prefix}/api/api.php   #入口脚本位置
app_pid_file=/var/run/swoole.pid  #pid文件

```

运行方式1
=====

[](#运行方式1)

- 修改app/Console/Kernel ,在$commands数组中添加 LaravelServer\\ServerCommand::class.
- php artisan server 启动服务器
- php artisan stop 停止服务器
- php artisan restart 重启服务器

运行方式2
=====

[](#运行方式2)

- chmod +x server
- ./smallApi start 启动服务
- ./smallApi stop 关闭服务
- ./smallApi reload 热重启服务，类似nginx reload
- ./smallApi restart 请求服务
- ./smallApi check 检测服务是否正常，这个命令可以配合一个 定时脚本用来检测服务是否正常，服务异常可以自动重启

### 可以将脚本放到 /etc/init.d目录下面 配合 chkconfig 命令实现开机自动运行 chkconfig --add smallApi

[](#可以将脚本放到-etcinitd目录下面-配合-chkconfig--命令实现开机自动运行-chkconfig---add-smallapi)

\#配置文件

```
config/server.php
    'bind_addr' => '0.0.0.0',  //绑定地址
    'port' => 82,              //绑定端口
    'debug_ip' => ['192.168.30.1', '127.0.0.1'],//限制日志输出的服务器
    'swoole' => []             //服务器配置参数

```

demo文件夹 示例代码说明(下面代码直接 php scriptname 方式运行)
==========================================

[](#demo文件夹-示例代码说明下面代码直接-php-scriptname-方式运行)

- baseServer 基础服务
- laravelServer 基于laravel框架的swoole服务器
- wsClient 模拟测试laraveServer服务器的websocket请求

\#webscoket 请求协议详细参考 wsClient代码

```
    $frame = '{"header":{},"get":{"username":"gw123","password":123456},"post":{},"body":"value"}';
    $frame = '{"header":{"path_info":"/test"},"get":{"username":"gw123","password":123456},"post":{},"body":"value"}';
    $frame = '{"header":{"path_info":"/gogo"},"get":{"username":"gw123","password":123456},"post":{},"body":"value"}';

    header 同http协议中的 header ,唯一不同的是需要指定  path_info 等同get的请求路径.
    所以协议默认请求下是模拟get请求 提交方式为 application/www-url-decode
    get  可以指定get参数
    post 指定post参数 需要配置header  设置REQUEST_METHOD为 POST
    body 是原始请求体用来实现一些特殊的请求(完善中)

```

调试
==

[](#调试)

- 将resource/debug.html 放到web目录下面
-
- 输入服务端网址 点击连接
- 发送调试信息到浏览器: \\LaravelServer\\SwooleLog::debug('not foung');

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 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 ~0 days

Total

5

Last Release

2938d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2362952ad4a60234c7195cf07fb105006652630b10a2c37f43329fb973d5826c?d=identicon)[gw123](/maintainers/gw123)

---

Top Contributors

[![gw123](https://avatars.githubusercontent.com/u/13729169?v=4)](https://github.com/gw123 "gw123 (1 commits)")

### Embed Badge

![Health badge](/badges/gw123-laravel-swoole/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k235.4M9.7k](/packages/symfony-framework-bundle)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[laravel/browser-kit-testing

Provides backwards compatibility for BrowserKit testing in the latest Laravel release.

5139.4M286](/packages/laravel-browser-kit-testing)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)

PHPackages © 2026

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