PHPackages                             zhaohehe/laravel-echo-server - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. zhaohehe/laravel-echo-server

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

zhaohehe/laravel-echo-server
============================

v0.0.1(9y ago)166.2k↓88%MITPHP

Since Jan 13Pushed 9y ago1 watchersCompare

[ Source](https://github.com/zhaohehe/laravel-echo-server)[ Packagist](https://packagist.org/packages/zhaohehe/laravel-echo-server)[ RSS](/packages/zhaohehe-laravel-echo-server/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

laravel-echo-server
-------------------

[](#laravel-echo-server)

> 这是一个用来支持laravel的事件广播的socket服务器

安装
--

[](#安装)

首先,你必须为你的php安装swoole扩展以及redis扩展,推荐使用php7

直接用composer安装

```
composer require zhaohehe/laravel-echo-server

```

然后在`app.php`中的providers数组中加入下面的一项

```
\EchoServer\BroadcastServerServiceProvider::class,

```

最后运行下面的命令,发布配置文件

```
php artisan vendor:publish

```

使用
--

[](#使用)

开启socket服务器

```
php artisan echo start

```

你可以在echo.php文件中配置服务器监听的端口,默认是:3523

你需要在.env中设置BROADCAST\_DRIVER=redis

前端代码:

```
>

    Title

    var msg = document.getElementById('msg');

    var wsServer = 'ws://localhost:3523';

    var websocket = new WebSocket(wsServer);

    websocket.onopen = function (evt) {
        console.log(websocket.readyState);

        var message = '{"channel": "test-channel", "event": "TestBroadcastEvent"}';
        websocket.send(message);

        //监听消息
        websocket.onmessage = function (evt) {
            msg.innerHTML += evt.data +'';
        };

    };

    // 关闭Socket....
    //websocket.close()

```

你的event必须实现ShouldBroadcast接口,那么,当你的事件被触发的时候,前端页面会获取到实时的message

最后
--

[](#最后)

这是一个非常简陋的事件广播服务,只实现了最基本的功能,验证一下想法,我会去仔细研究下reids和laravel的广播以及swoole然后来完善它。

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

3404d ago

### Community

Maintainers

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

---

Top Contributors

[![zhaohehe](https://avatars.githubusercontent.com/u/11255525?v=4)](https://github.com/zhaohehe "zhaohehe (3 commits)")

### Embed Badge

![Health badge](/badges/zhaohehe-laravel-echo-server/health.svg)

```
[![Health](https://phpackages.com/badges/zhaohehe-laravel-echo-server/health.svg)](https://phpackages.com/packages/zhaohehe-laravel-echo-server)
```

###  Alternatives

[strategery/magento2-infinitescroll

Magento2 InfiniteScroll module to load the next catalog page or results when scrolling down a page.

53246.2k1](/packages/strategery-magento2-infinitescroll)[web-id/laravel-playwright

Laravel Playwright Boilerplate

8315.5k](/packages/web-id-laravel-playwright)

PHPackages © 2026

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