3/20/2023
Filament PHP — the best Laravel admin panel you never knew about
TL;DR: Filament builds a fully functional CRUD in Laravel without writing HTML. Tables, forms, actions, filters — in 50 lines of PHP.
Every Laravel project eventually needs an admin panel. The classic approach is creating Blade templates for each model, duplicating the same code for tables, forms, and actions. By the third project, it starts to hurt. Filament solves this problem once and for all — instead of writing HTML, you write PHP, and the UI generates itself automatically.
What is Filament
Filament is a Composer package for Laravel that generates a fully functional admin panel built on Livewire and Alpine.js. It is not a code generator — it doesn’t create Blade files that you then have to maintain. Instead, you define the structure in PHP, and Filament renders the UI dynamically.
This is a fundamental difference from tools like Laravel Nova (paid) or hand-rolled panels. Filament is open source, actively developed, and by 2023 has over 10,000 stars on GitHub. Backpack is an alternative for simpler cases, but Filament is more flexible and has a better plugin ecosystem.
Installation and first Resource
composer require filament/filament:"^3.0"
php artisan filament:install --panels
php artisan make:filament-resource User --generate
The make:filament-resource User --generate command analyzes the User model and its migrations, then creates app/Filament/Resources/UserResource.php with generated fields. The --generate flag is optional — without it you get a skeleton to fill in manually, which gives you more control.
The panel is accessible at /admin. By default, access requires a user with a canAccessPanel() method returning true — just add it to the User model.
Table and form
The heart of every Resource is two methods: table() and form(). A complete UserResource example:
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('name')->sortable()->searchable(),
TextColumn::make('email')->sortable(),
ToggleColumn::make('is_active'),
TextColumn::make('created_at')->dateTime()->sortable(),
])
->filters([
TrashedFilter::make(),
SelectFilter::make('role')->options(['admin' => 'Admin', 'user' => 'User']),
]);
}
public static function form(Form $form): Form
{
return $form->schema([
TextInput::make('name')->required()->maxLength(255),
TextInput::make('email')->email()->required()->unique(ignoreRecord: true),
Select::make('role')->options(['admin' => 'Admin', 'user' => 'User']),
Toggle::make('is_active')->default(true),
]);
}
The result is a fully functional table with sorting, searching, and filtering, plus an edit modal form — without a single line of HTML.
Custom Actions
Filament lets you add actions both per-row and in bulk (on selected records). Example bulk action — sending an email to selected users:
BulkAction::make('send_newsletter')
->label('Send newsletter')
->icon('heroicon-o-envelope')
->action(function (Collection $records): void {
$records->each(fn (User $user) => Mail::to($user)->send(new NewsletterMail()));
})
->requiresConfirmation()
->deselectRecordsAfterCompletion(),
Per-row action for password reset:
Action::make('reset_password')
->action(function (User $record): void {
$record->update(['password' => Hash::make(Str::random(16))]);
Notification::make()->title('Password reset')->success()->send();
})
->requiresConfirmation(),
Filament v3 vs v2
Filament v3 (released in 2023) introduced several significant changes. The new renderer based on Tailwind CSS v3 significantly improved performance. Form components became a standalone package, allowing them to be used outside the admin panel — for example in public Livewire forms. Pages in v3 are dedicated PHP classes instead of Blade templates, making it easier to add custom logic. The v3 panel also supports multi-tenancy out of the box — one panel for multiple organizations.
Summary
Filament saves hundreds of lines of code on every project that needs an admin panel. For Laravel applications, it is the default choice today — faster than writing your own Blade templates, more flexible than code generators, cheaper than Laravel Nova. Time from installation to a working CRUD is literally a matter of minutes.