rolland97 / filament-resource-customizer
Customize Filament resources with optional Filament Shield permissions scaffolding.
Package info
github.com/rolland97/filament-resource-customizer
pkg:composer/rolland97/filament-resource-customizer
Fund package maintenance!
Requires
- php: ^8.3|^8.4
- illuminate/contracts: ^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/framework: 12.*
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.5.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
This package is auto-updated.
Last update: 2026-03-26 22:07:05 UTC
README
Customize Filament resources with optional Filament Shield permissions scaffolding.
What it does
- Splits a Filament resource table into dedicated column, filter, and action classes.
- Generates a permissions class per resource (optional).
- Builds or updates Filament Shield
resources.manageentries.
Requirements
- PHP 8.3+ | 8.4+
- Laravel 12
- Filament 4 or 5
This package is recommended alongside Filament Shield for generating resources.manage entries, but it also works without Filament Shield. You can disable permission class generation by setting permissions.enabled to false in the config.
Installation
composer require rolland97/filament-resource-customizer --dev
Publish the config:
php artisan vendor:publish --tag="filament-resource-customizer-config"
Publish stubs (optional):
php artisan vendor:publish --tag="filament-resource-customizer-stubs"
Quick Start
- Customize a resource:
php artisan filament:customize-resource DepartmentResource
(DepartmentResource is just an example — replace it with your actual resource class.)
- Or run everything at once:
php artisan filament:customize-resource-all DepartmentResource
Usage
Customize a resource by splitting tables/filters/actions into separate classes:
php artisan filament:customize-resource DepartmentResource
Target a specific panel:
php artisan filament:customize-resource DepartmentResource --panel=Admin
Generate a permissions class for a resource:
php artisan filament:make-resource-permissions DepartmentResource
Generate Filament Shield resources configuration:
php artisan filament:shield-config
Generate for a specific panel:
php artisan filament:shield-config --panel=Admin
Merge with existing resources:
php artisan filament:shield-config --merge
Run all steps (customize, permissions, and Shield config) in one command:
php artisan filament:customize-resource-all DepartmentResource
Run all steps for a specific panel:
php artisan filament:customize-resource-all DepartmentResource --panel=Admin
If resources, resources.manage, resources.subject, or resources.exclude are missing, the command will create them.
Commands
| Command | Description |
|---|---|
filament:customize-resource |
Generate table, column, filter, and action classes |
filament:make-resource-permissions |
Generate only the permissions class |
filament:shield-config |
Update Filament Shield resources.manage |
filament:customize-resource-all |
Run customize + permissions + Shield config |
Configuration
Key options in config/filament-resource-customizer.php:
resources_path: Where Filament resources live; accepts a string or array (default:app/Filament/Resources)stubs_path: Custom stub directory (default:stubs/filament-resource-customizer)panels.auto_detect: Auto-detect Filament panel resource paths underapp/Filament/*/Resources(default:true)permissions.enabled: Toggle permissions generationpermissions.placement:resource,parent, orcustompermissions.custom_path: Target path if placement iscustompermissions.namespace: Override permissions namespaceshield.default_methods: Default methods when no permissions class existsshield.static_resources: Always include these resources inmanageshield.merge: Default merge behavior forfilament:shield-config
Filament Shield integration
If you use Filament Shield, the filament:shield-config command will update resources.manage. By default it replaces entries unless you:
- pass
--merge, or - set
shield.mergetotruein the config.
Multi-panel setups
You can use any combination of these:
--panel=Adminto target a single panel for a command.resources_pathas an array, e.g.['app/Filament/Resources', 'app/Filament/Admin/Resources'].panels.auto_detect=trueto auto-addapp/Filament/*/Resourcesalongside the configured paths.
Example Structure
Running the customize command for a resource will generate classes like these:
app/Filament/Resources/Department/Departments/
├── DepartmentResource.php
├── DepartmentPermissions.php
└── Tables/
├── DepartmentsTable.php
├── DepartmentsColumn.php
├── DepartmentsFilter.php
├── DepartmentsRecordAction.php
└── DepartmentsToolbarAction.php
Testing
composer test
Changelog
Please see CHANGELOG for more information.
License
The MIT License (MIT). Please see License File for more information.