hamoi1 / filachat
FilaChat - Real-time customer support chat plugin for FilamentPHP v5
Fund package maintenance!
Requires
- php: ^8.2
- filament/filament: ^5.0
- livewire/livewire: ^4.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^8.0
- orchestra/testbench: ^9.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
README
Real-time customer support chat plugin for FilamentPHP v5 and Livewire v4.
FilaChat is a plugin for adding real-time customer support chat to your FilamentPHP application. It provides tools for both customer and agent chat interfaces, with features for managing and maintaining conversations. You can also disable role constraints to let users chat with each other without restrictions.
Important
This plugin has two roles: agent and user. When role restrictions are enabled, agents cannot chat with each other, and users cannot chat with each other. Only agents and users can communicate with one another. If role restrictions are disabled, everyone can freely chat without any restrictions.
Requirements
| Dependency | Version |
|---|---|
| PHP | ^8.2 |
| Laravel | ^11.0 or ^12.0 |
| FilamentPHP | ^5.0 |
| Livewire | ^4.0 |
Installation
Install the package via Composer:
composer require hamoi1/filachat
Run the install command to publish migrations and config:
php artisan filachat:install
Generate Filament assets:
php artisan filament:assets
You can view the full configuration file here: config/filachat.php
Setup
1. Apply the Trait
Add the HasFilaChat trait to your User model (and/or your Agent model if they differ):
<?php namespace App\Models; use Hamoi1\FilaChat\Traits\HasFilaChat; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { use HasFilaChat; // ... }
2. Create Agents (Optional)
Note
This step is only needed if you want to enable role restrictions. Agents are like admins who provide chat support to your users.
php artisan filachat:agent-create
3. Custom Theme
To integrate this plugin into your FilamentPHP application, you need a custom theme.
Add the plugin's views to your tailwind.config.js:
content: [ // ... './vendor/hamoi1/filachat/resources/views/**/**/*.blade.php', // ... ]
4. Register the Plugin
Add FilaChat to your panel provider:
<?php namespace App\Providers\Filament; use Filament\Panel; use Filament\PanelProvider; use Hamoi1\FilaChat\FilaChatPlugin; class AdminPanelProvider extends PanelProvider { public function panel(Panel $panel): Panel { return $panel // ... ->plugins([ FilaChatPlugin::make(), ]); } }
5. Broadcasting Setup
Important
FilaChat requires Laravel Reverb (or any broadcast driver) with FilamentPHP broadcasting enabled.
Start the broadcast server in your local environment:
php artisan reverb:start
For setup details, see the Laravel Reverb documentation and the Filament broadcasting guide.
File Uploads
Livewire has a default file size limit of 12 MB. To change this:
- Publish the Livewire config:
php artisan livewire:publish --config
- Adjust the upload rules in
config/livewire.php:
'temporary_file_upload' => [ 'rules' => 'max:20000', // 20 MB ],
- Update your
php.ini:
post_max_size = 20M upload_max_filesize = 20M
Localization
FilaChat supports full localization. Translation files are available at:
resources/lang/{locale}/filachat.php
Supported Languages
| Language | Locale |
|---|---|
| English | en |
| Arabic | ar |
Adding a New Language
- Create a new file at
resources/lang/{locale}/filachat.php - Copy the key structure from
en/filachat.php - Translate all values
To publish and customize the existing translations:
php artisan vendor:publish --tag=filachat-translations
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Jay-Are Ocero — Original Author
- Muhammad Esmail — Developer
- All Contributors
License
The MIT License (MIT). Please see License File for more information.