firstlightui / chat-server
Laravel package for Firstlight Chat backends: conversations, ordered messages, read cursors, unread counts, attachments, broadcasting and push through your own notifier.
Requires
- php: ^8.4
- firstlightui/chat-protocol: ^0.1
- illuminate/broadcasting: ^13.0
- illuminate/database: ^13.0
- illuminate/filesystem: ^13.0
- illuminate/http: ^13.0
- illuminate/notifications: ^13.0
- illuminate/routing: ^13.0
- illuminate/support: ^13.0
Requires (Dev)
- orchestra/testbench: ^11.0
- pestphp/pest: ^4.0|^5.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-28 20:13:29 UTC
README
A Laravel package that implements the server side of the Firstlight Chat protocol: conversations, messages numbered per conversation, delivered and read cursors, unread counts, private attachments, broadcasts and push.
composer require "firstlightui/chat-server:^1.0@beta"
php artisan migrate
Routes live under /api/chat behind auth:sanctum; change both in
config/chat.php (php artisan vendor:publish --tag=chat-config).
Conversations
Your app decides who can talk to whom, so conversations are created in your own code:
use FirstlightUI\ChatServer\Facades\Chat; $direct = Chat::direct($jo, $sam); // one per pair $group = Chat::group('Dinner', [$jo, $sam]); // the first member owns it Chat::add($group, $alex); Chat::remove($group, $sam);
Push
After a message is stored, the package calls
FirstlightUI\ChatServer\Contracts\ChatNotifier with every other member and
their unread total. The default sends NewChatMessage through the channels in
chat.notifications.channels; extend it with your channel's method, such as
toApn() or toFcm(), starting from apns() and fcm(), which already hold
the protocol's thread, tag, badge and payload keys. Or bind your own notifier.
Broadcasting
Events go to private-chat.user.{id} and carry IDs only. The package
registers the channel authorisation; enable Laravel broadcasting (Reverb or
Pusher) in your app.
License
MIT. See LICENSE.