Filament v5
Build powerful Laravel admin panels using Filament v5's server-driven UI with Schemas and Livewire v4 reactivity.
Overview
Filament v5 is a Laravel admin panel framework that provides complete CRUD interfaces, forms, tables, and dashboard components through a declarative PHP API. Built on Livewire v4, it offers real-time reactivity without writing JavaScript.
Key Concepts
- PanelProvider: Central configuration class defining your admin panel
- Resources: Automatic CRUD interfaces for Eloquent models
- Schemas: Declarative UI components (forms, tables, infolists)
- Actions: Interactive buttons with modals and backend logic
- Widgets: Dashboard components for data visualization
System Requirements
- Laravel 11.28+
- PHP 8.2+
- Livewire v4
- Node.js 18+
- Tailwind CSS v4.1+
Installation
Install Filament via Composer and scaffold a panel:
composer require filament/filament:"^5.0" -W
php artisan filament:install --scaffold
npm install && npm run dev
php artisan make:filament-user
This creates the panel provider, directory structure, and assets needed to start building.
Directory Structure
app/
Filament/
Resources/ # CRUD resources with forms and tables
Pages/ # Custom pages
Widgets/ # Dashboard widgets
Providers/
Filament/
AdminPanelProvider.php
Core Concepts
Panel Configuration
The PanelProvider is the entry point for your admin panel. It configures:
- Identity: ID, path, branding (name, logo, colors)
- Discovery: Auto-discovery of resources, pages, and widgets
- Middleware: Session, authentication, and custom middleware
- Tenancy: Multi-tenant configuration for SaaS applications
Resources
Resources provide complete CRUD interfaces through:
- Forms: Schema-based forms with 20+ field types (TextInput, Select, DatePicker, FileUpload, RichEditor, etc.)
- Tables: Data tables with columns, filters, sorting, and actions
- Pages: Automatic generation of List, Create, Edit, and View pages
- Relations: Relation managers for handling model relationships
Forms
Forms use a schema-based approach where you declare fields as PHP objects:
- Input Fields: Text, select, checkbox, toggle, date/time pickers
- Media: File and image uploads with validation
- Complex Fields: Rich text editors, repeaters, builders
- Layout: Grids, sections, tabs, and wizards
- Validation: Built-in Laravel validation rules
Tables
Tables display data with extensive customization:
- Columns: Text, badges, icons, images, colors
- Filters: Select, ternary, and custom filter logic
- Actions: Per-row actions, bulk actions, header actions
- Features: Search, sorting, pagination, grouping
Actions
Actions are interactive buttons that trigger:
- Modals: Form dialogs for data collection
- Confirmation: Destructive action confirmation
- Wizards: Multi-step processes
- Notifications: User feedback after completion
Widgets
Dashboard widgets include:
- Stats Overview: Metric cards with trends and sparklines
- Charts: Line, bar, pie charts using Chart.js
- Tables: Data tables for recent records
Testing
Filament uses Pest PHP with Livewire testing helpers:
- Page Testing: List, create, edit, view page functionality
- Form Testing: Validation, state management, submission
- Table Testing: Search, filters, sorting, actions
- Authorization Testing: Access control and permissions
Authorization
Access control through:
- Panel Access: FilamentUser contract for panel-level access
- Policies: Laravel policies for resource-level permissions
- Field Visibility: Show/hide fields based on user roles
- Multi-Tenancy: Tenant isolation for SaaS applications
Architecture Patterns
Server-Driven UI
Filament uses a server-driven approach where the backend defines the UI structure through schemas. The PHP code describes forms, tables, and layouts which Filament renders as Livewire components.
Schema System
Schemas are PHP configuration objects that define:
- Form fields and their validation rules
- Table columns and their formatting
- Layout containers (grids, sections, tabs)
- Action definitions and their behavior
Livewire Integration
All components mount as Livewire components, providing:
- Real-time reactivity without page reloads
- Automatic state management
- Event handling and AJAX updates
- Form validation with instant feedback
Resource-First Design
The framework encourages a resource-first approach:
- Define your Eloquent models
- Create resources that map to those models
- Configure forms and tables for each resource
- Add actions and widgets as needed
Command Reference
| Command |
Purpose |
filament:install --scaffold |
Install Filament with panel scaffolding |
make:filament-resource |
Create CRUD resource |
make:filament-page |
Create custom page |
make:filament-widget |
Create dashboard widget |
make:filament-panel |
Create additional panel |
make:filament-user |
Create admin user |
make:filament-relation-manager |
Create relation manager |
filament:cache-components |
Cache for production |
Detailed Documentation
Reference Guides
Comprehensive documentation for each component:
- Forms - All form components, validation rules, layouts, and conditional logic
- Tables - Column types, filters, actions, and table configuration
- Resources - CRUD resources, relation managers, infolists, and global search
- Infolists - Read-only data display components (TextEntry, ImageEntry, IconEntry)
- Widgets - Stats overview, charts, and table widgets
- Actions - Modal actions, notifications, action groups, and wizards
- Notifications - Flash messages, database, and broadcast notifications
- Schemas - Schema system, layouts, and component organization
- Testing - Pest testing patterns for resources, forms, tables, and authorization
- Authorization - Access control, policies, roles, and multi-tenancy
Code Examples
See examples.md for complete working code examples including:
- Complete resource implementations
- Form configurations
- Table setups
- Widget configurations
- Test suites
- Authorization patterns
Best Practices
Performance
- Use
getEloquentQuery() to eager load relationships and prevent N+1 queries
- Enable component caching in production with
filament:cache-components
- Limit pagination options and use deferred loading for large datasets
- Cache expensive calculations in widgets
Security
- Always implement the FilamentUser contract for panel access control
- Use Laravel policies for resource-level authorization
- Validate all input with appropriate form rules
- Never skip authorization in production environments
- Implement proper tenant isolation for multi-tenant applications
Code Organization
- Organize by feature:
app/Filament/Admin/Resources/
- Extract complex forms and tables to separate classes
- Create reusable form components for common patterns
- Keep resources focused on single responsibility
- Use dedicated pages for non-CRUD functionality
Testing
- Test all CRUD operations for each resource
- Validate form validation rules with multiple scenarios
- Test table features: search, filters, sorting, actions
- Verify authorization with different user roles
- Use factories to create realistic test data
When to Use Filament
Filament is ideal for:
- Admin Panels: Back-office interfaces for managing application data
- CMS: Content management systems with rich editing capabilities
- CRM: Customer relationship management tools
- E-commerce: Product, order, and inventory management
- SaaS Applications: Multi-tenant admin interfaces
- Internal Tools: Business process management and data entry
Additional Resources
Version: 1.0.0
License: MIT
Compatibility: Laravel 11+, PHP 8.2+, Livewire v4
1---2name: filament-pro3description: Build Laravel admin panels with Filament v5. Use for creating resources, forms, tables, widgets, and testing admin interfaces with Livewire v4.4license: MIT5---67# Filament v589Build powerful Laravel admin panels using Filament v5's server-driven UI with Schemas and Livewire v4 reactivity.1011## Overview1213Filament v5 is a Laravel admin panel framework that provides complete CRUD interfaces, forms, tables, and dashboard components through a declarative PHP API. Built on Livewire v4, it offers real-time reactivity without writing JavaScript.1415### Key Concepts1617- **PanelProvider**: Central configuration class defining your admin panel18- **Resources**: Automatic CRUD interfaces for Eloquent models19- **Schemas**: Declarative UI components (forms, tables, infolists)20- **Actions**: Interactive buttons with modals and backend logic21- **Widgets**: Dashboard components for data visualization2223### System Requirements2425- Laravel 11.28+26- PHP 8.2+27- Livewire v428- Node.js 18+29- Tailwind CSS v4.1+3031## Installation3233Install Filament via Composer and scaffold a panel:3435```bash36composer require filament/filament:"^5.0" -W37php artisan filament:install --scaffold38npm install && npm run dev39php artisan make:filament-user40```4142This creates the panel provider, directory structure, and assets needed to start building.4344### Directory Structure4546```47app/48 Filament/49 Resources/ # CRUD resources with forms and tables50 Pages/ # Custom pages51 Widgets/ # Dashboard widgets52 Providers/53 Filament/54 AdminPanelProvider.php55```5657## Core Concepts5859### Panel Configuration6061The PanelProvider is the entry point for your admin panel. It configures:6263- **Identity**: ID, path, branding (name, logo, colors)64- **Discovery**: Auto-discovery of resources, pages, and widgets65- **Middleware**: Session, authentication, and custom middleware66- **Tenancy**: Multi-tenant configuration for SaaS applications6768### Resources6970Resources provide complete CRUD interfaces through:7172- **Forms**: Schema-based forms with 20+ field types (TextInput, Select, DatePicker, FileUpload, RichEditor, etc.)73- **Tables**: Data tables with columns, filters, sorting, and actions74- **Pages**: Automatic generation of List, Create, Edit, and View pages75- **Relations**: Relation managers for handling model relationships7677### Forms7879Forms use a schema-based approach where you declare fields as PHP objects:8081- **Input Fields**: Text, select, checkbox, toggle, date/time pickers82- **Media**: File and image uploads with validation83- **Complex Fields**: Rich text editors, repeaters, builders84- **Layout**: Grids, sections, tabs, and wizards85- **Validation**: Built-in Laravel validation rules8687### Tables8889Tables display data with extensive customization:9091- **Columns**: Text, badges, icons, images, colors92- **Filters**: Select, ternary, and custom filter logic93- **Actions**: Per-row actions, bulk actions, header actions94- **Features**: Search, sorting, pagination, grouping9596### Actions9798Actions are interactive buttons that trigger:99100- **Modals**: Form dialogs for data collection101- **Confirmation**: Destructive action confirmation102- **Wizards**: Multi-step processes103- **Notifications**: User feedback after completion104105### Widgets106107Dashboard widgets include:108109- **Stats Overview**: Metric cards with trends and sparklines110- **Charts**: Line, bar, pie charts using Chart.js111- **Tables**: Data tables for recent records112113### Testing114115Filament uses Pest PHP with Livewire testing helpers:116117- **Page Testing**: List, create, edit, view page functionality118- **Form Testing**: Validation, state management, submission119- **Table Testing**: Search, filters, sorting, actions120- **Authorization Testing**: Access control and permissions121122### Authorization123124Access control through:125126- **Panel Access**: FilamentUser contract for panel-level access127- **Policies**: Laravel policies for resource-level permissions128- **Field Visibility**: Show/hide fields based on user roles129- **Multi-Tenancy**: Tenant isolation for SaaS applications130131## Architecture Patterns132133### Server-Driven UI134135Filament uses a server-driven approach where the backend defines the UI structure through schemas. The PHP code describes forms, tables, and layouts which Filament renders as Livewire components.136137### Schema System138139Schemas are PHP configuration objects that define:140- Form fields and their validation rules141- Table columns and their formatting142- Layout containers (grids, sections, tabs)143- Action definitions and their behavior144145### Livewire Integration146147All components mount as Livewire components, providing:148- Real-time reactivity without page reloads149- Automatic state management150- Event handling and AJAX updates151- Form validation with instant feedback152153### Resource-First Design154155The framework encourages a resource-first approach:1561. Define your Eloquent models1572. Create resources that map to those models1583. Configure forms and tables for each resource1594. Add actions and widgets as needed160161## Command Reference162163| Command | Purpose |164|---------|---------|165| `filament:install --scaffold` | Install Filament with panel scaffolding |166| `make:filament-resource` | Create CRUD resource |167| `make:filament-page` | Create custom page |168| `make:filament-widget` | Create dashboard widget |169| `make:filament-panel` | Create additional panel |170| `make:filament-user` | Create admin user |171| `make:filament-relation-manager` | Create relation manager |172| `filament:cache-components` | Cache for production |173174## Detailed Documentation175176### Reference Guides177178Comprehensive documentation for each component:179180- **[Forms](references/forms.md)** - All form components, validation rules, layouts, and conditional logic181- **[Tables](references/tables.md)** - Column types, filters, actions, and table configuration182- **[Resources](references/resources.md)** - CRUD resources, relation managers, infolists, and global search183- **[Infolists](references/infolists.md)** - Read-only data display components (TextEntry, ImageEntry, IconEntry)184- **[Widgets](references/widgets.md)** - Stats overview, charts, and table widgets185- **[Actions](references/actions.md)** - Modal actions, notifications, action groups, and wizards186- **[Notifications](references/notifications.md)** - Flash messages, database, and broadcast notifications187- **[Schemas](references/schemas.md)** - Schema system, layouts, and component organization188- **[Testing](references/testing.md)** - Pest testing patterns for resources, forms, tables, and authorization189- **[Authorization](references/authorization.md)** - Access control, policies, roles, and multi-tenancy190191### Code Examples192193See [examples.md](references/examples.md) for complete working code examples including:194- Complete resource implementations195- Form configurations196- Table setups197- Widget configurations198- Test suites199- Authorization patterns200201## Best Practices202203### Performance204205- Use `getEloquentQuery()` to eager load relationships and prevent N+1 queries206- Enable component caching in production with `filament:cache-components`207- Limit pagination options and use deferred loading for large datasets208- Cache expensive calculations in widgets209210### Security211212- Always implement the FilamentUser contract for panel access control213- Use Laravel policies for resource-level authorization214- Validate all input with appropriate form rules215- Never skip authorization in production environments216- Implement proper tenant isolation for multi-tenant applications217218### Code Organization219220- Organize by feature: `app/Filament/Admin/Resources/`221- Extract complex forms and tables to separate classes222- Create reusable form components for common patterns223- Keep resources focused on single responsibility224- Use dedicated pages for non-CRUD functionality225226### Testing227228- Test all CRUD operations for each resource229- Validate form validation rules with multiple scenarios230- Test table features: search, filters, sorting, actions231- Verify authorization with different user roles232- Use factories to create realistic test data233234## When to Use Filament235236Filament is ideal for:237238- **Admin Panels**: Back-office interfaces for managing application data239- **CMS**: Content management systems with rich editing capabilities240- **CRM**: Customer relationship management tools241- **E-commerce**: Product, order, and inventory management242- **SaaS Applications**: Multi-tenant admin interfaces243- **Internal Tools**: Business process management and data entry244245## Additional Resources246247- [Official Documentation](https://filamentphp.com/docs/5.x)248- [GitHub Repository](https://github.com/filamentphp/filament)249- [Live Demo](https://demo.filamentphp.com)250- [Discord Community](https://filamentphp.com/discord)251252---253254**Version**: 1.0.0 255**License**: MIT 256**Compatibility**: Laravel 11+, PHP 8.2+, Livewire v4