wyatts97 / flarum-chatroom
A real-time chatroom extension for Flarum v2.x
Package info
github.com/wyatts97/flarum-chatroom
Language:TypeScript
Type:flarum-extension
pkg:composer/wyatts97/flarum-chatroom
v1.3.7
2026-05-24 03:52 UTC
Requires
- php: >=8.2
- flarum/core: >=2.0.0-rc.1
README
A real-time chatroom extension for Flarum v2
Features
- Mithril Frontend — Built with TypeScript and Mithril JSX components.
- JSON:API Backend — Full Flarum JSON:API integration with proper serializers.
- MySQL Storage — Messages stored in a dedicated
chat_messagestable. - Logged-in Only — Chatroom accessible only to registered users.
- Polling MVP — Configurable polling interval for live message updates.
- Websocket-Ready — Event architecture (
ChatMessagePosted) ready for Pusher/WebSocket integration. - Modern Responsive UI — Mobile-friendly design with auto-scroll and clean aesthetics.
- Flood Control & Limits — Configurable rate limiting, max message length, and history limit.
Requirements
- PHP >= 8.2
- Flarum >= 2.0.0-rc.1
- MySQL / MariaDB
Installation
composer require wyatts97/flarum-chatroom php flarum migrate php flarum cache:clear
Build Frontend
cd js
npm install
npm run build
Admin Settings
- Polling interval — How often to poll for new messages (ms).
- Flood control — Minimum seconds between messages from the same user.
- Max message length — Character limit per message.
- Message history limit — How many messages to load at once.
API Endpoints
| Method | Endpoint | Action |
|---|---|---|
| GET | /api/chat/messages |
List messages |
| POST | /api/chat/messages |
Send message |
| DELETE | /api/chat/messages/{id} |
Delete message |
WebSocket Upgrade Path
The ChatMessagePosted event is dispatched on every new message. To switch from polling to WebSocket:
- Listen to
ChatMessagePostedin a service provider. - Broadcast the payload via Pusher, Ably, or Laravel Echo.
- On the frontend, replace the
setIntervalpolling inChatPage.tsxwith a WebSocket subscription.
License
MIT