PHPackages                             adultdate/filament-messages - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. adultdate/filament-messages

ActiveLibrary[Admin Panels](/categories/admin)

adultdate/filament-messages
===========================

Filament Messages is a powerful messaging plugin for FilamentPHP. It provides an easy-to-use interface for real-time messaging within Filament admin panels.

01PHP

Since Dec 17Pushed 4mo agoCompare

[ Source](https://github.com/adultdate/filament-messages)[ Packagist](https://packagist.org/packages/adultdate/filament-messages)[ RSS](/packages/adultdate-filament-messages/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

Filament Messages
=================

[](#filament-messages)

**Filament Messages** is a powerful messaging plugin for [FilamentPHP](https://filamentphp.com/). It provides an easy-to-use interface for real-time messaging within Filament admin panels.

[![screen-1](resources/images/screen-1.png)](resources/images/screen-1.png)

 [![](resources/images/screen-2.png)](resources/images/screen-2.png) [![](resources/images/screen-3.png)](resources/images/screen-3.png)

[![GitHub stars](https://camo.githubusercontent.com/19382400f0a762bc62c0d0411142ab474d0317e80f65ba524b6b7e73f1a450c6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6a65646473616c6962612f66696c616d656e742d6d657373616765733f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/19382400f0a762bc62c0d0411142ab474d0317e80f65ba524b6b7e73f1a450c6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6a65646473616c6962612f66696c616d656e742d6d657373616765733f7374796c653d666c61742d737175617265)[![GitHub issues](https://camo.githubusercontent.com/33b029d0cfca5d6bca118da0ff597e51e53c7049b76dcee4e1de6cf607a0cced/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6a65646473616c6962612f66696c616d656e742d6d657373616765733f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/33b029d0cfca5d6bca118da0ff597e51e53c7049b76dcee4e1de6cf607a0cced/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6a65646473616c6962612f66696c616d656e742d6d657373616765733f7374796c653d666c61742d737175617265)[![License](https://camo.githubusercontent.com/7d217ebb91a61cb4d98e70dee31eb08e0a5f71bc518ebd4151a73c6fb1191d00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75653f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/7d217ebb91a61cb4d98e70dee31eb08e0a5f71bc518ebd4151a73c6fb1191d00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75653f7374796c653d666c61742d737175617265)[![PHP Version](https://camo.githubusercontent.com/ce9f0244725ccf0d07ff15f075982163619c525ae3a126a455c052321643a0f6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322d626c75653f7374796c653d666c61742d737175617265266c6f676f3d706870)](https://camo.githubusercontent.com/ce9f0244725ccf0d07ff15f075982163619c525ae3a126a455c052321643a0f6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322d626c75653f7374796c653d666c61742d737175617265266c6f676f3d706870)[![Laravel Version](https://camo.githubusercontent.com/a8f36014948fbf4a9e26a90578ede3204ff540f82173785e3d8ffc717a6f6e87/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31312e302d7265643f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c)](https://camo.githubusercontent.com/a8f36014948fbf4a9e26a90578ede3204ff540f82173785e3d8ffc717a6f6e87/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31312e302d7265643f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c)[![Filament Version](https://camo.githubusercontent.com/995b9ebb1d0f6772810d48b9cd9837cdeded86f64302a776149aaafd77353756/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46696c616d656e742d332e322d707572706c653f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/995b9ebb1d0f6772810d48b9cd9837cdeded86f64302a776149aaafd77353756/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46696c616d656e742d332e322d707572706c653f7374796c653d666c61742d737175617265)

**Key Features:**

- **Seamless Integration:** Designed specifically for FilamentPHP, making it easy to integrate into your admin panel.
- **User-to-User &amp; Group Chats:** Enables both private conversations and group discussions.
- **Unread Message Badges:** Displays unread message counts in the sidebar for better visibility.
- **File Attachments:** Allows sending images, documents, and other media.
- **Database-Driven:** Uses Eloquent models for structured and scalable messaging.
- **Configurable Refresh Interval:** Lets you set the chat update frequency for optimized performance.
- **Timezone Support:** Allows setting a preferred timezone to maintain consistent timestamps across messages.

Quick Start
-----------

[](#quick-start)

```
# 1. Install dependencies
composer require adultdate/filament-messages
composer require filament/spatie-laravel-media-library-plugin:"^3.2" -W

# 2. Run installation command (publishes config, migrations, and migrates)
php artisan filament-messages:install

# 3. Add trait to User model
# Add: use Adultdate\FilamentMessages\Models\Traits\HasFilamentMessages;

# 4. Register plugin in AdminPanelProvider
# Add: FilamentMessagesPlugin::make()

```

Table of Contents
-----------------

[](#table-of-contents)

- [Quick Start](#quick-start)
- [Getting Started](#getting-started)
- [Prerequisite](#prerequisite)
- [User Model](#user-model)
- [Admin Panel Provider](#admin-panel-provider)
- [Configuration](#configuration)
- [Theming &amp; Customization](#theming--customization)
- [Features](#features)
- [API Usage](#api-usage)
- [Troubleshooting](#troubleshooting)
- [Plugins Used](#plugins-used)
- [Acknowledgments](#acknowledgments)
- [Support](#support)

Getting Started
---------------

[](#getting-started)

### Installation

[](#installation)

1. **Install the package via Composer:**

```
composer require adultdate/filament-messages

```

2. **The service provider will be automatically registered** via Laravel's package auto-discovery feature.
3. **Publish the configuration file** (optional):

```
php artisan vendor:publish --tag="filament-messages-config"

```

4. **Publish and run the migrations:**

```
php artisan vendor:publish --tag="filament-messages-migrations"
php artisan migrate

```

Or use the install command to do both steps automatically:

```
php artisan filament-messages:install

```

5. **Publish the views** (optional, for customization):

```
php artisan vendor:publish --tag="filament-messages-views"

```

6. **Add plugin assets to your Filament theme CSS** (Required for styling):

If you're using a custom Filament theme, add these lines to your theme CSS file (e.g., `resources/css/filament/admin/theme.css`):

```
/* For local plugin development (path repository) */
@import '../../../../plugins/filament-messages/resources/css/filament-messages.css';
@source '../../../../plugins/filament-messages/resources/views/**/*.blade.php';

/* For installed package (after publishing) */
@import '../../../../vendor/adultdate/filament-messages/resources/css/filament-messages.css';
@source '../../../../vendor/adultdate/filament-messages/resources/views/**/*.blade.php';

```

**Note:** Use the path that matches your installation method (local plugin or Composer package).

After adding these imports, rebuild your theme:

```
npm run build
# or
pnpm build

```

Prerequisite
------------

[](#prerequisite)

### Spatie Media Library

[](#spatie-media-library)

This plugin requires Filament Spatie Media Library for file attachments. Install it first:

```
composer require filament/spatie-laravel-media-library-plugin:"^3.2" -W

```

Publish and run the media library migrations:

```
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-migrations"
php artisan migrate

```

For more details, see the [official documentation](https://github.com/filamentphp/spatie-laravel-media-library-plugin).

### Service Provider (Auto-registered)

[](#service-provider-auto-registered)

The `FilamentMessagesServiceProvider` is **automatically registered** via Laravel's package auto-discovery. You don't need to manually add it to `config/app.php` or `bootstrap/providers.php`.

If auto-discovery is disabled in your project, manually add the provider:

```
// config/app.php or bootstrap/providers.php
'providers' => [
    // ...
    Adultdate\FilamentMessages\FilamentMessagesServiceProvider::class,
],

```

User Model
----------

[](#user-model)

Add the trait to your User model:

```

```

Admin Panel Provider
--------------------

[](#admin-panel-provider)

Add this plugin to your FilamentPHP panel provider:

```

```

Configuration
-------------

[](#configuration)

After publishing the config file, you can customize settings in `config/filament-messages.php`:

```
return [
    // Poll interval for checking new messages (in milliseconds)
    'poll_interval' => 5000,

    // Timezone for message timestamps
    'timezone' => config('app.timezone'),

    // Attachment settings
    'attachments' => [
        'max_file_size' => 5120,  // 5MB in KB
        'min_file_size' => 1,
        'max_files' => 5,
        'min_files' => 0,
    ],

    // Route slug for messages page
    'slug' => 'messages',
];

```

Theming &amp; Customization
---------------------------

[](#theming--customization)

### Custom Theme Integration

[](#custom-theme-integration)

If you're using a custom Filament theme (recommended), you **must** include the plugin's assets in your theme file:

1. **Locate your theme CSS file:**

    - Usually at `resources/css/filament/admin/theme.css`
    - Or wherever your panel's theme is defined
2. **Add the following imports:**

```
/* Import plugin CSS */
@import '../../../../vendor/adultdate/filament-messages/resources/css/filament-messages.css';

/* Include plugin Blade views for Tailwind purging */
@source '../../../../vendor/adultdate/filament-messages/resources/views/**/*.blade.php';

```

**For local development** (path repository):

```
@import '../../../../plugins/filament-messages/resources/css/filament-messages.css';
@source '../../../../plugins/filament-messages/resources/views/**/*.blade.php';

```

3. **Rebuild your theme:**

```
npm run build
# or for pnpm
pnpm build

```

### Customizing Views

[](#customizing-views)

1. **Publish the views:**

```
php artisan vendor:publish --tag="filament-messages-views"

```

2. **Edit the published views** in `resources/views/vendor/filament-messages/`
3. **Available views to customize:**

    - `livewire/messages/inbox.blade.php` - Conversation list
    - `livewire/messages/messages.blade.php` - Chat interface
    - `livewire/messages/search.blade.php` - Search functionality
    - `filament/pages/messages.blade.php` - Main messages page

### Styling Tips

[](#styling-tips)

- All components use Tailwind CSS classes
- Dark mode is supported via `dark:` classes
- Message bubbles use blue for sent messages, gray for received
- Use Flux UI components where available for consistency

Features
--------

[](#features)

### Real-time Messaging

[](#real-time-messaging)

- Live message updates with configurable polling interval
- Message read receipts and status tracking
- Typing indicators (planned)
- Online/offline status (planned)

### File Attachments

[](#file-attachments)

- Upload multiple files per message
- Support for images, documents, and media
- File size and type validation
- Download attachments with original filenames

### User Experience

[](#user-experience)

- Unread message badges
- Search conversations
- Create new conversations
- Group chat support
- Message timestamps with timezone support
- Dark mode compatible
- Mobile responsive design

### Security

[](#security)

- User authentication required
- Message ownership validation
- File upload restrictions
- CSRF protection

API Usage
---------

[](#api-usage)

### Programmatic Conversation Creation

[](#programmatic-conversation-creation)

```
use Adultdate\FilamentMessages\Models\Inbox;
use App\Models\User;

// Create a new conversation
$conversation = Inbox::create([
    'inbox_title' => 'Project Discussion',
]);

// Add participants
$user1 = User::find(1);
$user2 = User::find(2);

$conversation->users()->attach([$user1->id, $user2->id]);

```

### Sending Messages Programmatically

[](#sending-messages-programmatically)

```
use Adultdate\FilamentMessages\Models\Message;

$message = Message::create([
    'inbox_id' => $conversation->id,
    'user_id' => auth()->id(),
    'message' => 'Hello, this is a test message',
]);

// Add attachments
if ($file) {
    $message->addMedia($file)->toMediaCollection('filament-messages');
}

```

### Query Unread Messages

[](#query-unread-messages)

```
// Get unread messages for current user
$unreadMessages = auth()->user()->messages()
    ->whereJsonDoesntContain('read_by', auth()->id())
    ->get();

// Get unread count
$unreadCount = auth()->user()->messages()
    ->whereJsonDoesntContain('read_by', auth()->id())
    ->count();

```

### Mark Messages as Read

[](#mark-messages-as-read)

```
$message = Message::find($messageId);

// Add current user to read_by array
$readBy = $message->read_by ?? [];
if (!in_array(auth()->id(), $readBy)) {
    $readBy[] = auth()->id();
    $message->update([
        'read_by' => $readBy,
        'read_at' => array_merge($message->read_at ?? [], [now()]),
    ]);
}

```

### Listening for Events

[](#listening-for-events)

```
// In your EventServiceProvider or listener

use Adultdate\FilamentMessages\Events\MessageCreated;

Event::listen(MessageCreated::class, function ($event) {
    $message = $event->message;
    // Send notifications, update counters, etc.
});

```

Troubleshooting
---------------

[](#troubleshooting)

### Migrations not running automatically?

[](#migrations-not-running-automatically)

If migrations don't run automatically, publish and run them manually:

```
php artisan vendor:publish --tag="filament-messages-migrations"
php artisan migrate

```

### Views not loading?

[](#views-not-loading)

Clear your view cache:

```
php artisan view:clear
php artisan optimize:clear

```

### Service provider not registered?

[](#service-provider-not-registered)

Ensure your `composer.json` has auto-discovery enabled. If not, manually register the provider in `bootstrap/providers.php`:

```
return [
    App\Providers\AppServiceProvider::class,
    Adultdate\FilamentMessages\FilamentMessagesServiceProvider::class,
];

```

### Attachments not working?

[](#attachments-not-working)

Make sure you've installed and configured Spatie Media Library:

```
composer require filament/spatie-laravel-media-library-plugin:"^3.2" -W
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-migrations"
php artisan migrate

```

Also ensure the `Message` model has the `InteractsWithMedia` trait:

```
use Spatie\MediaLibrary\InteractsWithMedia;

class Message extends Model implements HasMedia
{
    use InteractsWithMedia;
}

```

### Styling not applied?

[](#styling-not-applied)

Make sure you've:

1. Added the CSS imports to your theme file
2. Run `npm run build` or `pnpm build` after adding imports
3. Cleared browser cache

```
php artisan optimize:clear
npm run build

```

### Messages not updating in real-time?

[](#messages-not-updating-in-real-time)

Check your polling interval in `config/filament-messages.php`:

```
'poll_interval' => 5000, // 5 seconds in milliseconds

```

Lower values = more frequent updates but higher server load.

Performance Tips
----------------

[](#performance-tips)

### Optimize Polling

[](#optimize-polling)

Adjust the poll interval based on your needs:

- High traffic: `10000` (10 seconds)
- Medium traffic: `5000` (5 seconds, default)
- Low traffic: `3000` (3 seconds)

### Database Indexing

[](#database-indexing)

Add indexes to improve query performance:

```
// In a migration
Schema::table('fm_messages', function (Blueprint $table) {
    $table->index('inbox_id');
    $table->index('user_id');
    $table->index('created_at');
});

Schema::table('fm_inboxes', function (Blueprint $table) {
    $table->index('updated_at');
});

```

### Enable Query Caching

[](#enable-query-caching)

Consider caching conversation lists for better performance:

```
use Illuminate\Support\Facades\Cache;

$conversations = Cache::remember(
    "user.{$userId}.conversations",
    now()->addMinutes(5),
    fn() => $user->conversations()->latest()->get()
);

```

### Queue File Processing

[](#queue-file-processing)

For large file uploads, process them in background jobs:

```
// In your message creation logic
dispatch(new ProcessMessageAttachment($message, $file));

```

Best Practices
--------------

[](#best-practices)

1. **Keep messages paginated** - The plugin loads 10 messages at a time by default
2. **Use appropriate file size limits** - Configure in `config/filament-messages.php`
3. **Monitor database size** - Consider archiving old conversations
4. **Use CDN for media** - Configure Spatie Media Library to use S3 or similar
5. **Implement proper authorization** - Use Laravel policies to control access
6. **Test with multiple users** - Ensure real-time updates work correctly
7. **Enable database transactions** - Messages are already wrapped in transactions

Plugins Used
------------

[](#plugins-used)

These are [Filament Plugins](https://filamentphp.com/plugins) use for this project.

**Plugin****Author**[Filament Spatie Media Library](https://github.com/filamentphp/spatie-laravel-media-library-plugin)[Filament Official](https://github.com/filamentphp)

Acknowledgments
---------------

[](#acknowledgments)

- [FilamentPHP](https://filamentphp.com)
- [Laravel](https://laravel.com)
- [FilaChat](https://github.com/199ocero/filachat)

Support
-------

[](#support)

- [Report a bug](https://github.com/jeddsaliba/filament-messages/issues)
- [Request a feature](https://github.com/jeddsaliba/filament-messages/issues)
- [Email support](mailto:jeddsaliba@gmail.com)

Show Your Support
-----------------

[](#show-your-support)

Give a ⭐️ if this project helped you!

filament-messages
=================

[](#filament-messages-1)

filament-messages
=================

[](#filament-messages-2)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance50

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/cd883f243eac90139be92ab7cf99608411f09b2be1a64cd1b58cf6920362e473?d=identicon)[adultdate](/maintainers/adultdate)

---

Top Contributors

[![blhk0532](https://avatars.githubusercontent.com/u/221689993?v=4)](https://github.com/blhk0532 "blhk0532 (3 commits)")

### Embed Badge

![Health badge](/badges/adultdate-filament-messages/health.svg)

```
[![Health](https://phpackages.com/badges/adultdate-filament-messages/health.svg)](https://phpackages.com/packages/adultdate-filament-messages)
```

###  Alternatives

[jeroennoten/laravel-adminlte

Easy AdminLTE integration with Laravel

4.0k4.8M43](/packages/jeroennoten-laravel-adminlte)[dmstr/yii2-adminlte-asset

AdminLTE backend theme asset bundle for Yii 2.0 Framework

1.1k1.8M67](/packages/dmstr-yii2-adminlte-asset)[dwij/laraadmin

LaraAdmin is a Open source Laravel Admin Panel / CMS which can be used as Admin Backend, Data Management Tool or CRM boilerplate for Laravel with features like CRUD Generation, Module Manager, Media, Menus, Backups and much more

1.6k68.7k](/packages/dwij-laraadmin)[filament/spatie-laravel-media-library-plugin

Filament support for `spatie/laravel-medialibrary`.

1764.8M125](/packages/filament-spatie-laravel-media-library-plugin)[bezhansalleh/filament-exceptions

A Simple &amp; Beautiful Pluggable Exception Viewer for FilamentPHP's Admin Panel

193195.9k13](/packages/bezhansalleh-filament-exceptions)[filament/infolists

Easily add beautiful read-only infolists to any Livewire component.

1220.8M36](/packages/filament-infolists)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
