Scaffold 2 by EMMAN
CommunityGenerate migrations, models, factories, resources, controllers, routes, Shield policies and API services for a table from a single form in your panel.
Author:
EMMAN
Package health
Automated checks of this plugin's Composer package
15 checks
- Skipped: GitHub Actions pinned to SHA
- Skipped: GitLab CI includes pinned to SHA
- Passed: Open security advisories
- Passed: Dependabot PR responsiveness — No open Dependabot PRs.
- Skipped: Renovate MR responsiveness
- Skipped: Dependabot or Renovate configured
- Skipped: Dependency update cooldown configured
- Failed: Provides a security policy — View details on Plumb
- Passed: Abandoned or archived — No consulted source marks the package abandoned (packagist, github).
- Passed: Commit and release recency — Active: last commit 0 days ago; last release 2 days ago.
-
Passed:
composer.lock not committed by library
—
composer.lockis absent from the released dist archive. - Passed: Dist archive is lean
-
Passed:
Current Laravel version supported
— Package dependencies resolve together with current Laravel
13.0. -
Passed:
Current PHP version supported
— Constraint
^8.2supports current PHP8.6. - Skipped: Current Symfony version supported
filament/
namespace. Review the source and install at your own risk. Found
malware or an unresolved security issue the author won't
address?
Report it
.
Documentation
- Description
- Features
- Requirements
- Installation
- Publishing Configuration file
- Usage
- Screenshot
- Changelog
- Contributing
- Security Vulnerabilities
- Credits
- License
#Description
Filament Scaffold 2 is a toolkit for Filament v4 and v5 that simplifies the generation of resources. Fill in one form inside your panel and it generates the migration, model, factory, Filament resource, controller, route, Shield policy and API service for a table. It aims to speed up development and reduce the time spent writing repetitive code.
Note
Filament Scaffold 2 is a rebuild of solution-forest/filament-scaffold, which supports Filament v3 only. It adds a new generation flow, validation of every generated name, and optional Shield and API integrations. See Credits.
#Features
-
Automatic Filament Resource Generation: the migration runs first, then
make:filament-resource --generatebuilds the form and table from the real database columns, in the v4/v5 resource layout (Resource + Schemas + Tables + Pages). -
Support for Multiple Resource Types: generates the migration (and runs it), model, factory, Filament resource, controller, route, Shield policy and API service.
-
New or Existing Tables: design the columns in the form (including enum values, nullable, default, unique/index and comments), or pick an existing table to load its columns.
-
Relationships: a
foreignIdcolumn (for examplecategory_id→categories) becomesforeignId()->constrained()in the migration and abelongsTo()in the model, so the generated resource gets a dropdown of categories instead of a number field. -
Custom Labels: give a column a label (for example
full_name→ "Buong Pangalan") and it is added as->label()to the generated form field and table column. -
Preview (dry run): see what Create Scaffold will do before anything is written: the list of files to create, skip or overwrite, the commands it will run, and the exact migration, model and route code.
-
Any Database: table introspection uses Laravel's Schema builder (MySQL, MariaDB, SQLite, PostgreSQL).
-
Safe by Default: on in local development, off in production unless you turn it on, never overwrites existing models or policies, and rejects names that aren't valid PHP/SQL identifiers before writing anything.
-
Optional Integrations: Filament Shield policies and permissions (created by
shield:generate, so they follow your Shield config) and Filament API Service endpoints. These options only show when the packages are installed.
#Requirements
- PHP 8.2+
- Laravel 11, 12 or 13
- Filament v4 or v5
#Installation
You can install the package via composer:
composer require emmanpbarrameda/filament-scaffold2
Then, make sure your database connection is set in the .env file.
In your project, app/Providers/Filament/xxxPanelProvider.php, add the plugin:
use Emmanpbarrameda\FilamentScaffold2\FilamentScaffoldPlugin;
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugins([
FilamentScaffoldPlugin::make(),
]);
}
That's it. With APP_ENV=local, the Scaffold Manager is on by default. In any other environment (for example production) it is off unless you turn it on.
To change it, set this in the .env of that environment:
FILAMENT_SCAFFOLD2_ENABLED=true # force on
FILAMENT_SCAFFOLD2_ENABLED=false # force off
Warning
The Scaffold Manager writes PHP files and runs migrations. You can enable it on a production server, but it is not recommended. If you do, make sure only trusted users can access it (for example with Filament Shield permissions).
#Permissions (Filament Shield)
If you use Filament Shield, generate the policy and permissions for the Scaffold Manager page:
php artisan shield:generate --resource=ScaffoldResource --panel=admin --option=policies_and_permissions
The package registers App\Policies\ScaffoldPolicy for its own model automatically, so the Scaffold permissions in Roles decide who can open the page. Without a policy, every panel user who can see the panel can open it.
#Publishing Configuration file
To publish the configuration file, use:
php artisan vendor:publish --tag="filament-scaffold2-config"
return [
'enabled' => env('FILAMENT_SCAFFOLD2_ENABLED', env('APP_ENV', 'production') === 'local'),
'navigation' => [
'group' => 'System',
'icon' => 'heroicon-o-cube-transparent',
'sort' => 99,
'label' => 'Scaffold2 Manager',
],
'policy' => 'App\\Policies\\ScaffoldPolicy',
];
enabled defaults to true when APP_ENV=local and false everywhere else. When it is off, the page is not registered at all.
policy is the policy class registered for the Scaffold Manager page (see Permissions). It is only registered when the class exists and your app hasn't registered one itself. Set it to null to skip it.
#Usage
Your panel will have a System > Scaffold2 Manager page.
- New table: type a table name, add the columns, and keep "Create Migration" and "Run Migrate" checked.
- Existing table: pick it in "Choose Table". Its columns are loaded (foreign keys become
foreignIdrows) and "Create Migration" is unchecked automatically. - Relationship: set the column Type to
foreignId(the name must end with_id), pick the Related table, and choose On delete:restrict(default, blocks deleting a related record that is still in use),cascade(deletes these rows too) orset null(needs Nullable). The table you're creating is in the list too, for self-references likeparent_id. - Label (optional, per column): the placeholder shows the label Filament would use by default (
full_name→ "Full name"). Type your own to override it in the generated form and table.
Click Preview to check the result first. A modal lists every step (create, skip because it exists, overwrite, run) and shows the migration, model and route code exactly as they will be written, plus any validation error. Nothing is written or run. The Filament resource is generated by Filament itself, so the preview only lists its file and your labels.
Click Create Scaffold. The steps run in this order:
- Migration, then
migrate - Model
- Factory
- Filament resource (
--generate, so the form and table come from the real columns), then your column labels are added as->label() - Controller and route
- Cache clear (
optimize:clearand Filament's cached panel components, so the new resource shows up right away) - Shield policy and permissions (
shield:generatein a separate process, using yourconfig/filament-shield.phpnaming; new permissions go tosuper_admin) - API service
Existing model and policy files are never overwritten. If the table already exists, the migration step is skipped with a warning.
A belongsTo() is only written when the related model exists in app/Models (for example Category for categories). Otherwise the notification tells you which relationship to add after creating that model. The inverse side (hasMany() on the related model) is not added for you.
Note
The resource's form and table come from Filament's own make:filament-resource --generate, which picks each field and column from the database column type. Review the generated files and adjust labels, relationships and validation as needed.
#Screenshot

#Changelog
Please see CHANGELOG for more information on what has changed recently.
#Contributing
Issues and pull requests are welcome on GitHub. Please describe the Filament, Laravel and PHP versions you are using.
#Security Vulnerabilities
The Scaffold Manager turns form input into PHP files. It is off outside local development by default; keep it that way unless you have a reason to enable it. If you find a security issue, please open a private security advisory instead of a public issue.
#Credits
- Emmanuel P. Barrameda: Filament v4/v5 rebuild and maintenance
- Solution Forest and the contributors of solution-forest/filament-scaffold: the original package this project is based on
- All Contributors
#License
The MIT License (MIT). This project keeps the original copyright notice of solution-forest/filament-scaffold. Please see License File for more information.
The author
From the same author
Featured Plugins
A selection of plugins curated by the Filament team
Compact Theme
A theme that makes data-heavy panels easier to scan by fitting more useful information on each screen.
Filament
Advanced Tables (formerly Filter Sets)
Supercharge your tables with powerful features like user-customizable views, quick filters, multi-column sorting, advanced table searching, convenient view management, and more. Compatible with Resource Panel Tables, Relation Managers, Table Widgets, and Table Builder!
Kenneth Sese
Custom Fields
Eliminate custom field migrations forever. Let your users create and manage form fields directly in Filament admin panels with 20+ built-in field types, validation, and zero database changes.
Relaticle