Download the PHP package faraztanveer/laravel-chat without Composer
On this page you can find all versions of the php package faraztanveer/laravel-chat. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download faraztanveer/laravel-chat
More information about faraztanveer/laravel-chat
Files in faraztanveer/laravel-chat
Package laravel-chat
Short Description This is my package laravel-chat
License MIT
Homepage https://github.com/faraztanveer/laravel-chat
Informations about the package laravel-chat
π¬ Laravel Chat
β¨ Features
| ### π― **Zero Configuration** - Works out of the box with sensible defaults - Auto-discovered database migrations - No complex setup required | ### β‘ **Lightning Fast** - Optimized database queries - Minimal performance overhead - Ready for real-time implementations |
| ### π§ **Fully Customizable** - Use your existing models and rules - Extend functionality as needed - Clean, simple architecture | ### π‘οΈ **Enterprise Ready** - Middleware-friendly design - Configurable API routes - Production-tested and reliable |
π‘ Perfect for: Chat applications, messaging systems, customer support platforms, team collaboration tools, and any real-time communication needs.
π Installation
π¦ Optional: Publish configuration file
βοΈ Quick Start
1οΈβ£ Setup Your User Model
Add the HasChatChannels trait to your user model:
2οΈβ£ Start Chatting!
That's it! Your application now has a fully functional chat system. The package provides RESTful API endpoints for all chat operations.
ποΈ Configuration
The package works seamlessly out of the box, but you can customize it to fit your needs.
Configuration file (config/laravel-chat.php):
π‘ API Reference
All endpoints are available under /api/{route_prefix} (default: /api/chat).
| Method | Endpoint | Description | Request Body/Parameters |
|---|---|---|---|
POST |
/channel |
Create or retrieve a chat channel | {"participant_id": 2} |
GET |
/channels |
List user's chat channels | β |
GET |
/channel |
Get specific channel details | ?channel_id=1 |
POST |
/message |
Send a message to channel | {"channel_id": 1, "body": "Hello!"} |
GET |
/messages |
Retrieve channel messages | ?channel_id=1 |
Example Usage
π¨ Customization
Custom Display Names
Override the display name for chat participants:
Custom Participant Columns
Specify which columns to include in API responses:
Middleware Customization
You can customize authentication and authorization middleware in the configuration file:
πͺ Event Listeners & Extending Chat Actions
This package dispatches events when key chat actions occur, allowing you to react (broadcast, notify, etc) in your own appβwithout modifying package code.
Listening for Chat Events
You may listen for chat events by creating listeners with Artisan:
When a chat channel is created or a message is stored, your listener's handle method will be called automatically with the corresponding Eloquent model.
Example: Message Stored Listener
Example: Channel Created Listener
Resource Classes
The package provides resource classes (e.g. MessageResource, ChatChannelResource) which convert your models into the same format as your API responses.
You can use these in your listeners for logging, broadcasting, or passing structured data to your frontendβensuring consistency between your API and event-driven features.
What You Get in Your Listener
- For message events:
$event->messageis a fullMessageEloquent model. - For channel events:
$event->channelis a fullChatChannelEloquent model. - Use the provided resources for serialization if needed.
That's it! Your app can now respond to every chat action, with models and resources consistent with your APIs. For advanced event usage, see the Laravel Events documentation.
π€ Contributing
We welcome contributions! Here's how you can help make Laravel Chat even better:
- π Found a bug? Open an issue
- π‘ Have an idea? Start a discussion
- π§ Want to contribute code? Check our contributing guide
- π Improve documentation? Documentation PRs are always welcome!
π‘οΈ Security
Security is a top priority. If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
See SECURITY.md for our security policy and vulnerability reporting process.
π Requirements
- PHP 8.2+
- Laravel 12.0+
- Database (MySQL, PostgreSQL, SQLite, SQL Server)
πΊοΈ Roadmap
- [ ] File attachment support
- [ ] Message reactions and emojis
- [ ] Message threading
- [ ] Advanced search functionality
- [ ] Message encryption
- [ ] Group chat management
- [ ] Message status indicators (sent, delivered, read)
π License
This package is open-sourced software licensed under the MIT License.
π¨βπ» Credits
- Faraz Tanveer - Creator & Maintainer
- All Contributors - Thank you! π
All versions of laravel-chat with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.0