PHPackages                             julioccorreia/reverb-hooks - 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. julioccorreia/reverb-hooks

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

julioccorreia/reverb-hooks
==========================

Fluent event hooks for Laravel Reverb.

v1.0.0(4mo ago)525MITPHPPHP ^8.2CI passing

Since Dec 27Pushed 4mo agoCompare

[ Source](https://github.com/julioccorreia/reverb-hooks)[ Packagist](https://packagist.org/packages/julioccorreia/reverb-hooks)[ RSS](/packages/julioccorreia-reverb-hooks/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

Laravel Reverb Hooks
====================

[](#laravel-reverb-hooks)

[![Latest Version on Packagist](https://camo.githubusercontent.com/88e9cc6b968b6bb5056fdb5dc62b23bf6cacca1bedc80a6615cf0da31df12b97/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a756c696f63636f72726569612f7265766572622d686f6f6b732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/julioccorreia/reverb-hooks)[![GitHub Tests Action Status](https://camo.githubusercontent.com/d9dfcc351234fc2a7e4e51c2b09b994a5559ec6c8fcd64b96d98bb8f28039c6f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a756c696f63636f72726569612f7265766572622d686f6f6b732f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/julioccorreia/reverb-hooks/actions)[![Total Downloads](https://camo.githubusercontent.com/0fc40d1ee653372f5af3679ae52176493c2b4d84f98b4218bfe236718ac5f488/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a756c696f63636f72726569612f7265766572622d686f6f6b732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/julioccorreia/reverb-hooks)[![PHPStan Level 9](https://camo.githubusercontent.com/fa7d257d0c5c1cf237ac3490ef3a5561626b17fcb0a8547c01b0bb8746554e60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230392d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/phpstan/phpstan)

A lightweight and powerful package to intercept and hook into Laravel Reverb server events with ease.

This package allows you to listen to channel creation, message delivery, and connection lifecycle events using a clean, fluent API.

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 11.x or 12.x
- Laravel Reverb

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require julioccorreia/reverb-hooks
```

Usage
-----

[](#usage)

The best place to register your hooks is in the `boot` method of your `AppServiceProvider` or a dedicated `EventServiceProvider`.

Channel Hooks
-------------

[](#channel-hooks)

You can listen to when channels are created or removed. Supports wildcards for flexible filtering.

```
use JulioCCorreia\ReverbHooks\Facades\ReverbHooks;

// Listen to any channel creation
ReverbHooks::onChannelCreated(function ($event) {
    Log::info("Channel created: {$event->channel->name()}");
});

// Listen to specific channels using wildcards
ReverbHooks::onChannelCreated('chat.*', function ($event) {
    // This only triggers for channels starting with 'chat.'
});
```

Message Hooks
-------------

[](#message-hooks)

Intercept messages as they flow through the Reverb server.

```
// Triggers when a message is successfully sent to a channel
ReverbHooks::onMessageSent('orders.*', function ($event) {
    // Perfect for logging or metrics
});

// Triggers when any raw message is received by the server
ReverbHooks::onMessageReceived(function ($event) {
    // Low-level access to the incoming payload
});
```

Connection Hooks
----------------

[](#connection-hooks)

Monitor the health of your WebSocket server.

```
// Triggers when a stale connection is pruned by the server
ReverbHooks::onConnectionPruned(function ($event) {
    Log::warning("Connection pruned for user: {$event->connection->identifier()}");
});
```

Available
---------

[](#available)

MethodDescriptiononChannelCreated($channels, $callback)Triggered when a new channel is instantiated.onChannelRemoved($channels, $callback)Triggered when a channel is destroyed.onMessageSent($channels, $callback)Triggered after a message is broadcasted.onMessageReceived($callback)Triggered upon receiving a raw message from a client.onConnectionPruned($callback)Triggered when the server cleans up an inactive connection.Development &amp; Quality
-------------------------

[](#development--quality)

This package maintains high code quality standards:

- **PHPStan**: Analyzed at Level 9 for maximum type safety.
- **Laravel Pint**: Follows the official Laravel coding style.
- **Rector**: Automated code refactoring for modern PHP features.
- **Strict Types**: All files use declare(strict\_types=1).

Testing
-------

[](#testing)

You can run the tests using Pest:

```
composer test
```

Changelog
---------

[](#changelog)

Please see CHANGELOG for more information on what has changed recently.

Credits
-------

[](#credits)

**Júlio César Correia Gazige**

[![GitHub](https://camo.githubusercontent.com/800bad6e848cfe326ea2f1606bc3e7ab04aff9c1008e73c48b39a34a156c7f92/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6769746875622d2532333132313031312e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465)](https://github.com/julioccorreia)[![LinkedIn](https://camo.githubusercontent.com/835f91c273c180e842aa0b2fb0d5ccc52def20089589abbcefceb28317c583f8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c696e6b6564496e2d3030373742353f7374796c653d666f722d7468652d6261646765266c6f676f3d6c696e6b6564696e266c6f676f436f6c6f723d7768697465)](https://www.linkedin.com/in/julioccorreia/)

License
-------

[](#license)

The MIT License (MIT). Please see License File for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance76

Regular maintenance activity

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.6% 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

137d ago

### Community

Maintainers

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

---

Top Contributors

[![julioccorreia](https://avatars.githubusercontent.com/u/79464861?v=4)](https://github.com/julioccorreia "julioccorreia (19 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")

---

Tags

eventlaraveleventswebsocketreal-timeWebSocketshooksHOOKreverb

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/julioccorreia-reverb-hooks/health.svg)

```
[![Health](https://phpackages.com/badges/julioccorreia-reverb-hooks/health.svg)](https://phpackages.com/packages/julioccorreia-reverb-hooks)
```

###  Alternatives

[laravel/reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.

1.5k9.4M48](/packages/laravel-reverb)[tormjens/eventy

The WordPress filter/action system in Laravel

438912.9k16](/packages/tormjens-eventy)[brainboxlabs/brain-socket

Websockets for event-driven Laravel apps.

58740.5k](/packages/brainboxlabs-brain-socket)[pusher/pusher-http-laravel

\[DEPRECATED\] A Pusher bridge for Laravel

400509.0k3](/packages/pusher-pusher-http-laravel)[morozovsk/websocket

simple php websocket server with examples and demo: simple chat (single daemon) - http://sharoid.ru/chat.html , pro chat (master + worker) - http://sharoid.ru/chat2.html , simple game - http://sharoid.ru/game.html

36417.3k2](/packages/morozovsk-websocket)[denis660/laravel-centrifugo

Centrifugo broadcaster for laravel

113164.7k](/packages/denis660-laravel-centrifugo)

PHPackages © 2026

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