Drop-in comments for Filament with Commentions

By Navneet Rai

Building commenting systems from scratch is one of those features that sounds simple until you actually start implementing it. You need comment models, user mentions, reactions, permissions, real-time updates, and a clean UI that fits your admin panel. What starts as "just add comments" quickly becomes a complex feature that takes weeks to build properly.

If you're using Filament for your admin panel, you already know the incredible power of this framework. Filament has revolutionized Laravel development by providing beautiful, full-stack components that accelerate development while maintaining the elegance and flexibility Laravel developers love. With the recent release of Filament v4 (officially stable as of August 2025), the framework has reached new heights with significant performance improvements, unified schemas, and enhanced flexibility that make building sophisticated admin interfaces even more effortless.

Now, with Commentions - fully compatible with both Filament v3 and the cutting-edge v4 release - you can extend that same elegance to commenting systems. As Filament's official development agency partner, Kirschbaum Development has created a drop-in commenting solution that feels like it was built into Filament from day one.

Instead of building all of this from scratch, wouldn't it be cool if you could just do something like this?

// In your Filament InfoList
CommentsEntry::make('comments')
->mentionables(fn (Model $record) => User::all())

Or add it as a simple table action:

// In your Filament table
->recordActions([
CommentsAction::make()
->mentionables(User::all())
])

This is exactly what Commentions brings to your Filament application - a complete commenting system built with deep understanding of Filament's patterns and philosophy.

Why we built Commentions

As Filament's official development agency partner, Kirschbaum Development is dedicated to elevating the experience of working with Filament. With Dan Harrin as a member of our team and our commitment to supporting Filament's growth, we're uniquely positioned to understand what developers need most.

Filament has transformed how we approach Laravel development. Its component-driven architecture, intuitive APIs, and stunning design system have made building complex admin panels not just faster, but genuinely enjoyable. The recent stable release of Filament v4 has taken this even further, delivering impressive performance improvements (up to 3x faster for large datasets), unified schemas that seamlessly combine forms, infolists, and layout components, and support for custom table data that opens up entirely new possibilities for dynamic interfaces.

Through our work on large, complex Filament projects - leveraging everything from Filament's powerful table builders to its flexible form components - we found ourselves building similar commenting features repeatedly across client applications. Each time, we'd create comment models, build mention systems, handle permissions, and design interfaces that perfectly matched Filament's aesthetic excellence. We realized we were solving the same problem over and over again - and if we were facing this challenge, so were countless other developers in the thriving Filament community.

Our partnership with Filament means we're not just building packages - we're crafting solutions that seamlessly extend Filament's philosophy of elegant, powerful components. With full compatibility for both Filament v3 and the groundbreaking v4 release, Commentions embraces the framework's evolution while maintaining the simplicity and power that makes Filament so exceptional. Whether you're leveraging v4's new unified schemas or sticking with the proven patterns of v3, Commentions adapts to provide the same exceptional experience.

Getting started

Installation is straightforward - just require the package and publish the migrations:

composer require kirschbaum-development/commentions
php artisan vendor:publish --tag="commentions-migrations"

Next, implement the required interfaces on your models:

// User model
use Kirschbaum\Commentions\Contracts\Commenter;
 
class User extends Model implements Commenter
{
// Your existing user model
}
 
// Any model you want to add comments to
use Kirschbaum\Commentions\HasComments;
use Kirschbaum\Commentions\Contracts\Commentable;
 
class Project extends Model implements Commentable
{
use HasComments;
}

That's it for the setup. Your models are now ready to support comments.

Multiple ways to add comments

One of Filament's greatest strengths is its flexibility - the framework adapts to your workflow rather than forcing you into rigid patterns. Commentions embraces this philosophy by offering multiple integration options that work seamlessly with Filament's component system.

In InfoLists (recommended)

Leveraging Filament's powerful InfoList components, the cleanest approach is adding comments directly to your resource views:

Infolists\Components\Section::make('Comments')
->schema([
CommentsEntry::make('comments')
->mentionables(fn (Model $record) => User::all()),
]),

As table actions

Filament's table builder is incredibly versatile, and with v4's enhanced performance and support for custom data, it's become even more powerful. Commentions integrates beautifully for quick commenting directly from your table views. The package automatically detects your Filament version and uses the appropriate action format:

// Filament v4 (latest)
->recordActions([
CommentsAction::make()
->mentionables(User::all())
])
// Filament v3 (still supported)
->actions([
CommentsTableAction::make()
->mentionables(User::all())
])

As header actions

Perfect for dedicated comment management, taking advantage of Filament's consistent action patterns:

protected function getHeaderActions(): array
{
return [
CommentsAction::make(),
];
}

Smart mentions and events

One of Commentions' most powerful features is its mention system. When users mention someone in a comment using @username, the package automatically dispatches events you can hook into:

// Listen for mentions
use Kirschbaum\Commentions\Events\UserWasMentionedEvent;
 
class SendUserMentionedNotification implements ShouldQueue
{
public function handle(UserWasMentionedEvent $event): void
{
$event->user->notify(
new UserMentionedInCommentNotification($event->comment)
);
}
}

The package also dispatches events for new comments and reactions, giving you complete control over notifications and integrations.

Real-time updates with polling

Modern users expect real-time updates, and Filament's thoughtful architecture makes this effortless to implement. With v4's performance optimizations and partial rendering capabilities, real-time features are more efficient than ever. Commentions leverages Filament's built-in polling capabilities to deliver live comment updates:

CommentsEntry::make('comments')
->poll('10s') // Poll every 10 seconds
->mentionables(User::all())

This integration showcases what makes Filament exceptional - complex functionality becomes simple configuration. The polling works seamlessly with Filament's lifecycle and, with v4's enhanced performance optimizations, runs more efficiently than ever. Comments refresh automatically without requiring page refreshes or complex JavaScript, while v4's partial rendering ensures minimal resource usage.

Advanced customization

Custom comment models

Need additional fields or logic? Extend the base Comment model:

class CustomComment extends \Kirschbaum\Commentions\Comment
{
protected $fillable = ['body', 'author_id', 'commentable_id', 'commentable_type', 'priority'];
}

Then update your config:

// config/commentions.php
'comment' => [
'model' => \App\Models\CustomComment::class,
],

Flexible permissions

The package includes sensible defaults for permissions, but you can override them completely:

class CommentPolicy extends CommentionsPolicy
{
public function create(Commenter $user): bool
{
return $user->can('create-comments');
}
 
public function update($user, Comment $comment): bool
{
return $user->id === $comment->author_id || $user->isAdmin();
}
 
public function delete($user, Comment $comment): bool
{
return $user->id === $comment->author_id || $user->isAdmin();
}
}

Custom display names and avatars

Filament's commitment to beautiful, consistent interfaces extends to how users are represented, and v4's unified schemas make component integration even more seamless. Control how users appear in comments by implementing Filament's standard interfaces:

use Filament\Models\Contracts\HasName;
use Filament\Models\Contracts\HasAvatar;
 
class User extends Model implements Commenter, HasName, HasAvatar
{
public function getFilamentName(): string
{
return $this->full_name ?? $this->email;
}
 
public function getFilamentAvatarUrl(): ?string
{
return $this->avatar_url;
}
}

This approach demonstrates Filament's excellent design philosophy - consistent interfaces that work across the entire ecosystem.

Beyond comments: activity streams

Sometimes you want to show more than just user comments. Commentions supports "renderable comments" - custom items that appear in the comment stream:

public function getComments(): Collection
{
// Get status changes
$statusHistory = $this->statusHistory()->get()->map(
fn (StatusHistory $history) => new RenderableComment(
id: $history->id,
authorName: $history->user->name,
body: sprintf('Status changed from %s to %s', $history->old_status, $history->new_status),
createdAt: $history->created_at,
)
);
 
// Merge with actual comments
$comments = $this->comments()->latest()->with('author')->get();
 
return $statusHistory->merge($comments)->sortByDesc('createdAt');
}

This creates a unified activity stream showing both comments and system events.

Real-world impact

The difference Commentions makes becomes clear when you compare implementation approaches. This comparison also highlights why Filament has become so beloved in the Laravel community, especially with the recent v4 release bringing even more power and performance:

Without Commentions (traditional approach)

Building a commenting system from scratch requires handling multiple complex pieces:

  • Multiple database tables and migrations for comments, mentions, and reactions

  • Custom Livewire components that match Filament's sophisticated styling

  • Manual mention parsing and validation logic

  • Permission systems scattered across controllers and policies

  • Custom CSS to achieve Filament's beautiful, consistent aesthetic

  • Event dispatching infrastructure for notifications and integrations

  • Real-time update handling with WebSockets or polling mechanisms

  • Form builders that integrate seamlessly with Filament's patterns

  • Responsive design that works across Filament's breakpoints

  • Testing suites for all the custom functionality

With Commentions + Filament's power

CommentsEntry::make('comments')
->mentionables(User::all())
->poll('30s')

This transformation exemplifies what makes Filament extraordinary - it turns complex requirements into elegant, readable code. With v4's performance improvements and unified schemas, this elegance comes with even better performance and flexibility. Commentions extends this philosophy, providing enterprise-grade commenting functionality through Filament's intuitive component system.

Embracing Filament's excellence

Commentions embodies both the Laravel philosophy of making complex things simple and Filament's commitment to beautiful, intuitive interfaces. As developers who have witnessed Filament transform from an innovative idea into an essential tool for Laravel development, we're continually amazed by its impact on our productivity and code quality. The recent stable release of Filament v4 represents a major milestone, bringing substantial performance improvements, unified schemas, and enhanced flexibility that push the boundaries of what's possible with admin interfaces.

Filament's component-driven architecture, thoughtful APIs, and attention to detail have set a new standard for admin panel development. With v4's 3x performance improvements for large datasets, seamless integration of forms and infolists through unified schemas, and support for custom table data, the framework has evolved to handle even the most demanding applications while maintaining its signature elegance.

The package handles the hard parts - mention parsing, event dispatching, permission checking, and UI consistency - while giving you hooks to customize behavior for your specific needs. Every component follows Filament's conventions, every style matches Filament's aesthetic excellence, and every interaction feels natural within the framework. With full support for both Filament v3 and v4, you can confidently upgrade your Filament installation knowing that Commentions will continue to work seamlessly.

Our partnership with Filament ensures that Commentions isn't just another package - it's a first-class citizen in the Filament ecosystem. Whether you're building a project management tool, a content management system, or any application where users need to collaborate through comments, Commentions provides the foundation you need without compromising the elegance that makes Filament special.

Give it a try in your next Filament project. Your users will appreciate the familiar, polished commenting experience that matches Filament's high standards, and your development team will appreciate the time saved on a feature that "just works" - built by developers who live and breathe Filament every day, with deep appreciation for the framework that has revolutionized Laravel development.

Navneet Rai
Software Developer
Author Image

Interested in speaking with a developer?

Connect with us.
©2025 Kirschbaum Development Group LLC Privacy Policy Terms of Service