ritechoice23/laravel-chat-engine
Composer 安装命令:
composer require ritechoice23/laravel-chat-engine
包简介
A UI-agnostic, transport-agnostic, polymorphic chat engine for Laravel with message versioning, reactions, bookmarks, and delivery tracking.
关键字:
README 文档
README
A UI-agnostic, transport-agnostic, polymorphic chat engine for Laravel.
Features
- Polymorphic Actors - Users, Teams, Bots, or any model can chat
- Thread Types - Direct, Group, Channel, Broadcast, Custom
- Rich Messages - Text, Image, Video, Audio, File, Location, Contact, Custom
- Attachments - Multi-file uploads, view-once media, direct request uploads
- Security - Thread locks, PIN protection, E2E verification codes
- Reactions - Emoji reactions via
laravel-reactionsintegration - Bookmarks - Save/bookmark messages via
laravel-saveableintegration - Delivery Tracking - Delivered and read receipts
- Edit History - Immutable message versions (configurable)
- Soft/Hard Delete - Configurable deletion modes
- Authorization - Built-in policies for threads and messages
- Pipelines - Message processing (sanitize, mentions, URLs, profanity)
- Events - Domain events for all actions
- API Resources - Ready-to-use JSON transformations
Requirements
- PHP 8.2+
- Laravel 11.x or 12.x
Installation
composer require ritechoice23/laravel-chat-engine
Publish the config file:
php artisan vendor:publish --tag="chat-engine-config"
Run migrations:
php artisan migrate
Quick Start
Add the trait to your User model:
use Ritechoice23\ChatEngine\Traits\CanChat; class User extends Authenticatable { use CanChat; }
Start chatting:
use Ritechoice23\ChatEngine\Facades\Chat; // Create a thread $thread = Chat::thread()->between($userA, $userB)->create(); // Send a message $message = Chat::message() ->from($userA) ->to($thread) ->text('Hello!') ->send(); // React to message $userB->react($message, '❤️'); // Bookmark message $userB->saveItem($message); // Mark as read $message->markAsReadBy($userB);
File Uploads
Upload files directly from Laravel requests:
// Single file Chat::message() ->from($request->user()) ->to($thread) ->text('Check this out!') ->attachUpload($request->file('photo')) ->send(); // Multiple files Chat::message() ->from($request->user()) ->to($thread) ->attachUploads($request->file('attachments')) ->send(); // View-once (self-destructing) Chat::message() ->from($request->user()) ->to($thread) ->attachUploadViewOnce($request->file('secret')) ->send();
Message Types
// Text Chat::message()->from($user)->to($thread)->text('Hello')->send(); // Image Chat::message()->from($user)->to($thread) ->image('https://...', 'Caption')->send(); // Video Chat::message()->from($user)->to($thread) ->video('https://...', 'thumb.jpg', 120)->send(); // File Chat::message()->from($user)->to($thread) ->file('https://...', 'doc.pdf', 'application/pdf')->send(); // Location Chat::message()->from($user)->to($thread) ->location(40.7128, -74.0060, 'NYC')->send(); // Contact Chat::message()->from($user)->to($thread) ->contact('John Doe', '+1234567890', 'john@example.com')->send();
Thread Types
// Direct (1-on-1, automatically deduplicated) Chat::thread()->between($userA, $userB)->create(); // Group Chat::thread()->group('Team Chat')->participants([$u1, $u2, $u3])->create(); // Channel Chat::thread()->channel('announcements')->create(); // Broadcast Chat::thread()->broadcast('System Updates')->create();
Documentation
See /docs for complete documentation:
| Getting Started | Core Features | System | Advanced |
|---|---|---|---|
| Installation | Threads | Events | Encryption |
| Configuration | Messages | Policies | Retention |
| Attachments | Pipelines | Scaling | |
| Security | Presence | Customization | |
| Delivery | API Resources | ||
| Reactions | |||
| Bookmarks |
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
If you discover a security vulnerability, please send an email to daramolatunde23@gmail.com. All security vulnerabilities will be promptly addressed.
Credits
License
The MIT License (MIT). Please see License File for more information.
ritechoice23/laravel-chat-engine 适用场景与选型建议
ritechoice23/laravel-chat-engine 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 01 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「real-time」 「messaging」 「chat」 「laravel」 「eloquent」 「polymorphic」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ritechoice23/laravel-chat-engine 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ritechoice23/laravel-chat-engine 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ritechoice23/laravel-chat-engine 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Talk is a Laravel based realtime messaging, chatting and conversation system. It helps to develop users messaging, chatting and conversations in easy way.
This simple PHP class allows you to easily generate Smartsupp.com JS chat code.
Client for the REST API plugin of the OpenFire Server
Boxalino Real Time User Experience (RTUX) Magento2 plugin
Laravel package for generating Agora.io tokens (RTC, RTM, Chat) with support for both V1 and V2 token formats
PHP library for Broadcastt HTTP API
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 36
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-06