zakharov-andrew/yii2-messenger
最新稳定版本:v0.0.1
Composer 安装命令:
composer require zakharov-andrew/yii2-messenger
包简介
Yii2 Messenger
README 文档
README
🚀 Yii2 messenger - Chat Module for Yii2 📨✨
The Yii2 messenger provides a complete solution for messaging between users, including private conversations and group chats with advanced management capabilities.
Features • Installation • Usage • System Requirements • Contributing • License
🔥 Features
💬 Messaging System
- Real-time text messaging ⚡
- Message history view 📜
- Delete your own messages 🗑️
- Admin ability to delete any messages 🛡️
👥 Group Chats
- Create chats with name and description 🏷️
- Upload chat avatar 🖼️
- Different access types:
- 🔗 Public (via link)
- ✉️ Invite-only
- 🔒 Private (manual addition only)
- View participant list 👀
🛠 Chat Management (for admins)
- Assign administrators 👑
- Flexible permission system:
- Delete messages 🗑️
- Ban users ⛔
- Temporary mute users 🔕
- Add/remove participants ➕➖
- Edit chat info ✏️
- Manage other admins 🛡️
- View statistics and activity 📊
🤝 Private Messages
- Automatic chat creation for first message 🤖
- List of all conversations 📋
- Search message history 🔍
🚀 Installation
The preferred way to install this extension is through composer.
Either run
$ composer require zakharov-andrew/yii2-messenger
or add
"zakharov-andrew/yii2-messenger": "*"
to the require section of your composer.json file.
Subsequently, run
./yii migrate/up --migrationPath=@vendor/zakharov-andrew/yii2-messenger/migrations
in order to create the settings table in your database.
Or add to console config
return [ // ... 'controllerMap' => [ // ... 'migrate' => [ 'class' => 'yii\console\controllers\MigrateController', 'migrationPath' => [ '@console/migrations', // Default migration folder '@vendor/zakharov-andrew/yii2-messenger/src/migrations' ] ] // ... ] // ... ];
Usage
Add this to your main configuration's modules array
'modules' => [ 'messenger' => [ 'class' => 'ZakharovAndrew\messenger\Module', 'bootstrapVersion' => 5, // if use bootstrap 5 'defaultChatImage' => '/images/default-product-image.jpg', // Path to the default image for a chat 'uploadWebDir' => '/web/path/to/upload/dir/' ], 'imageupload' => [ 'class' => 'ZakharovAndrew\imageupload\Module', 'uploadDir' => '/path/to/upload/dir/', ], // ... ],
Note: the maximum number of additional parameters is 3. Change the value of uploadDir to the directory for uploading images. Uses the yii2-image-upload-widget module to upload images.
Add this to your main configuration's urlManager array
'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => [ // ... 'chat/<url:[\w\d\-]+>' => 'messenger/chat/view', // ... ], ],
🎨 Frontend Integration
The module provides:
- Ready-to-use AJAX controllers for easy integration 📡
- Responsive interface (mobile-friendly) 📱
- Customizable styling options 🎨
📌 System Requirements
- PHP 7.4+
- Yii2 2.0.40+
- MySQL 5.7+ or PostgreSQL 9.5+
👥 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-27