zakharov-andrew / yii2-messenger
Yii2 Messenger
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=7.3
- zakharov-andrew/yii2-image-upload-widget: *
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.