wyatts97/flarum-chatroom
Composer 安装命令:
composer require wyatts97/flarum-chatroom
包简介
A real-time chatroom extension for Flarum v2.x
README 文档
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
统计信息
- 总下载量: 42
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-24