twopoint0/reverb-chat
Composer 安装命令:
composer require twopoint0/reverb-chat
包简介
Realtime chat package using Laravel Reverb
README 文档
README
A modular, real-time chat package for Laravel powered by Laravel Reverb.
Features
- 💬 Private & Group Chat
- ⚡ Real-time messaging (WebSocket)
- 📎 File attachments
- 🌐 API + Web UI
- 🧱 Clean and scalable architecture
- 🔌 Easy integration with any Laravel app
Installation
1. Install via Composer
composer require twopoint0/reverb-chat
2. Publish Config
php artisan vendor:publish --tag=reverb-chat-config
3. Run Migration
php artisan migrate
4. Install Laravel Reverb (Required)
composer require laravel/reverb php artisan reverb:install
5. Configure .env
BROADCAST_DRIVER=reverb REVERB_APP_ID=local REVERB_APP_KEY=your_key REVERB_APP_SECRET=your_secret REVERB_HOST=127.0.0.1 REVERB_PORT=8080 REVERB_SCHEME=http
6. Run Services
php artisan reverb:start php artisan queue:work
⚙️ Configuration
return [ 'user_model' => App\Models\User::class, 'user_table' => 'users', 'api_prefix' => 'api/reverb-chat', ];
🌐 Routes
📡 API Routes
Base URL:
http://127.0.0.1:8000/api
| Method | Endpoint | Description |
|---|---|---|
| POST | /open-group | Create or open private chat |
| POST | /{chat}/message | Send message using chat ID |
| POST | /user/{user}/message | Send message to user |
| GET | /messages/{chat_id} | Get chat messages |
| GET | /messages/user/{user_id} | Get messages with user |
| GET | /list | Get chat list |
🌐 Web Routes
Base URL:
http://127.0.0.1:8000
| Method | Endpoint | Description |
|---|---|---|
| GET | /message | Chat home page |
| POST | /chatroom | Open chat room |
| POST | /send-message | Send message |
💬 API Usage
🔹 Open or Create Chat
POST /api/chat/open-group
{
"user_id": 2
}
🔹 Send Message (Chat ID)
POST /api/chat/{chat_id}/message
{
"message": "Hello"
}
🔹 Send Message (User)
POST /api/chat/user/{user_id}/message
🔹 Get Messages
GET /api/chat/messages/{chat_id}
🔹 Chat List
GET /api/chat/list
⚡ Realtime Example
window.Echo.channel('chat.1') .listen('sendMessage', (e) => { console.log(e.message); });
🧱 Database Tables
- chats
- chat_messages
- chat_users
- chat_message_attachments
🛠 Requirements
- PHP >= 8.2
- Laravel 11 / 12 / 13
- Laravel Reverb
🔮 Upcoming Features
- Typing indicator
- Seen / delivered system
- Online users (presence)
- Notifications
- Multi-tenant support
🤝 Contributing
Pull requests are welcome. Feel free to improve this package.
📄 License
MIT License
twopoint0/reverb-chat 适用场景与选型建议
twopoint0/reverb-chat 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 04 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 twopoint0/reverb-chat 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 twopoint0/reverb-chat 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-10