Download the PHP package phunky/laravel-messaging-reactions without Composer
On this page you can find all versions of the php package phunky/laravel-messaging-reactions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phunky/laravel-messaging-reactions
More information about phunky/laravel-messaging-reactions
Files in phunky/laravel-messaging-reactions
Package laravel-messaging-reactions
Short Description Message reactions extension for phunky/laravel-messaging
License MIT
Homepage https://github.com/phunky/laravel-messaging-reactions
Informations about the package laravel-messaging-reactions
Laravel Messaging Reactions
Per-message reactions for phunky/laravel-messaging. Each conversation participant can add one reaction per message. Values are plain strings — emoji, icon slugs (e.g. for Flux <flux:icon>), or any convention your UI uses.
Installation
Register the extension in config/messaging.php (add to the existing extensions array — do not remove the core keys):
Usage
Resolve ReactionService via the container (constructor injection, app(ReactionService::class), etc.):
Reacting to a message
Each participant has at most one reaction per message (one row per participant, updated in place). Only conversation participants may react — others throw an exception.
Removing a reaction
Fetching reactions
Message relationship
Message::reactions() is registered as a hasMany macro — call it as a method:
Events
ReactionAdded and ReactionRemoved extend [BroadcastableMessagingEvent](https://github.com/phunky/laravel-messaging) from the core package. They implement ShouldBroadcast and ShouldDispatchAfterCommit, respect config('messaging.broadcasting.enabled'), and use the same private conversation channels as core messaging. With Laravel Echo, listen using the broadcastAs() name with a leading dot (e.g. .listen('.messaging.reaction.added', …)).
| Event | Public properties | broadcastAs() |
|---|---|---|
ReactionAdded |
$reaction, $message, $messageable |
messaging.reaction.added |
ReactionRemoved |
$message, $messageable, $reaction (string) |
messaging.reaction.removed |
ReactionAdded includes the full Reaction model (participant is loaded before dispatch). ReactionRemoved passes the reaction string because the row is already gone.
License
MIT - see LICENSE.md.