PHPackages                             aoeng/laravel-workerman - 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. aoeng/laravel-workerman

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

aoeng/laravel-workerman
=======================

laravel workerman websocket

1.0.2(3y ago)0130MITPHPPHP &gt;=8.0

Since Aug 4Pushed 3y ago1 watchersCompare

[ Source](https://github.com/aoeng/laravel-workerman)[ Packagist](https://packagist.org/packages/aoeng/laravel-workerman)[ RSS](/packages/aoeng-laravel-workerman/feed)WikiDiscussions master Synced today

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

Workerman 的Laravel 扩展
---------------------

[](#workerman-的laravel-扩展)

### 安装

[](#安装)

```
composer require aoeng/laravel-workerman

php artisan vendor:publish --tag=workerman
```

### 使用

[](#使用)

- 本扩展是以事件的形式处理Workerman的各种消息 具体可查看 [laravel事件系统](https://learnku.com/docs/laravel/9.x/events)
- 配置文件：`config/workerman.php`
- 可用事件

```
Aoeng\Laravel\Workerman\Events\WorkermanOnWorkerStart::class
Aoeng\Laravel\Workerman\Events\WorkermanOnConnect::class
Aoeng\Laravel\Workerman\Events\WorkermanOnWebSocketConnect::class
Aoeng\Laravel\Workerman\Events\WorkermanOnMessage::class
Aoeng\Laravel\Workerman\Events\WorkermanOnClose::class
Aoeng\Laravel\Workerman\Events\WorkermanOnWorkerStop::class
```

- 监听器参考

```
namespace App\Listeners;

use Aoeng\Laravel\Workerman\Events\WorkermanOnMessage;
use Aoeng\Laravel\Workerman\Facades\Gateway;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;

class HandleSocketMessage
{
    /**
     * Handle the event.
     *
     * @param WorkermanOnMessage $event
     * @return void
     */
    public function handle(WorkermanOnMessage $event)
    {
        info('测试', [$event->message]);
        Gateway::sendToCurrentClient('你说的对');
    }
}
```

- 注意 laravel事件默认禁用自动发现可通过以下方式开启或者进行手动绑定

```
// Providers/EventServiceProvider.php
public function shouldDiscoverEvents()
{
    return true;
}
```

- 注意每次修改完成后请重启workerman服务
- 启动服务

```
php artisan workerman start|stop|restart|reload|status [--d]
```

- `Gateway`laravel Facade 具体可查看 [Workerman官方文档](https://www.workerman.net/doc/gateway-worker/lib-gateway-functions.html)

```
//例如
 Aoeng\Laravel\Workerman\Facades\Gateway::isUidOnline($uid);
```

- 前端链接请每30s发送一个心跳包

###  Health Score

26

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Total

3

Last Release

1324d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/232ecb94ec5cc972c1b573db64a1e20e0656fe3a182ce540e99c1d9dd31f46e9?d=identicon)[aoeng](/maintainers/aoeng)

---

Top Contributors

[![aoeng](https://avatars.githubusercontent.com/u/23565714?v=4)](https://github.com/aoeng "aoeng (2 commits)")

---

Tags

laravelwebsocketworkerman

### Embed Badge

![Health badge](/badges/aoeng-laravel-workerman/health.svg)

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

###  Alternatives

[denis660/laravel-centrifugo

Centrifugo broadcaster for laravel

111155.4k](/packages/denis660-laravel-centrifugo)[basement-chat/basement-chat

Add a real-time chat widget to your Laravel application.

4963.8k](/packages/basement-chat-basement-chat)[huang-yi/shadowfax

Run Laravel on Swoole.

3511.7k](/packages/huang-yi-shadowfax)[sockeon/sockeon

Framework-agnostic PHP WebSocket and HTTP server library with attribute-based routing and support for namespaces and rooms.

281.1k2](/packages/sockeon-sockeon)

PHPackages © 2026

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