joserick / filament-devtool
A development tool for FilamentPHP
Requires
- php: ^8.3
- composer-runtime-api: ^2.2
- orchestra/sidekick: ^1.2
- orchestra/workbench: ^11.0
Requires (Dev)
- filament/blueprint: ^2.1
- filament/filament: ^5.0
- laravel/boost: ^2.4
- laravel/pint: ^1.29
- laravel/sail: ^1.0
- orchestra/pest-plugin-testbench: ^4.1
- orchestra/testbench: ^11.1
- phpstan/phpstan: ^2.2
README
Filament DevTool is an agile tool that enables the creation of FilamentPHP v5 components within Laravel packages under development. It replaces Filament's original make: commands with versions that generate code directly in the package's src/ structure instead of the Laravel application skeleton.
Features
- ๐ All Filament
make:commands rewritten for package development - ๐ฆ File generation in
src/using Orchestra Canvas - ๐ณ Docker/Sail development environment included
- ๐งช Integration with Orchestra Testbench for package testing
- โก No need for a full Laravel application to develop components
Requirements
Installation
As a development dependency in your package
composer require --dev joserick/filament-devtool
The package will be automatically registered thanks to Laravel's package discovery.
Using the Sail/Docker development environment
Run the installation script directly with curl:
curl -s https://filament-devtool.joserick.com/install | bash
The install.sh script:
- Clones the
joserick/filament-devtoolrepository - Copies
stubs/compose.stubtocompose.yml - Installs Composer dependencies using Docker
- Builds the Sail image for PHP 8.5
- Sets up permissions for the
vendor/directory
Once finished, start the containers:
cd filament-devtool && vendor/bin/sail up -d
Usage
Available commands
All Filament make: commands are available through Canvas. Run them using the canvas alias:
vendor/bin/sail php vendor/bin/canvas
Included commands
| Command | Description |
|---|---|
make:filament-resource |
Creates a panel Resource |
make:filament-page |
Creates a panel Page |
make:filament-widget |
Creates a Widget |
make:filament-cluster |
Creates a panel Cluster |
make:filament-relation-manager |
Creates a Relation Manager |
make:form-field |
Creates a form field |
make:form |
Creates a form component |
make:livewire-form |
Creates a Livewire form |
make:rich-content-custom-block |
Creates a custom block for Rich Content |
make:table-column |
Creates a table column |
make:table |
Creates a table component |
make:livewire-table |
Creates a Livewire table |
make:infolist-entry |
Creates an Infolist entry |
make:schema-component |
Creates a Schema component |
make:schema |
Creates a Schema |
make:livewire-schema |
Creates a Livewire Schema |
make:filament-importer |
Creates an Importer |
make:filament-exporter |
Creates an Exporter |
make:filament-issue |
Creates an Issue |
Examples
# Create a resource vendor/bin/sail php vendor/bin/canvas make:filament-resource User # Create a form field vendor/bin/sail php vendor/bin/canvas make:form-field ColorPicker # Create a page vendor/bin/sail php vendor/bin/canvas make:filament-page Settings
Generated files are automatically placed in src/ following the package structure (canvas.yaml).
Recommended terminal aliases
Add these aliases to your ~/.bashrc or ~/.zshrc:
alias sail='vendor/bin/sail' alias canvas='vendor/bin/sail php vendor/bin/canvas' alias testbench='vendor/bin/sail php vendor/bin/testbench'
Testing
Run tests with Pest:
vendor/bin/sail php vendor/bin/pest
To run a specific test file:
vendor/bin/sail php vendor/bin/pest tests/Feature/MakeResourceCommandTest.php
Testbench
Use Testbench as an Artisan alias to interact with the Laravel skeleton application:
vendor/bin/sail php vendor/bin/testbench make:model User vendor/bin/sail php vendor/bin/testbench migrate vendor/bin/sail php vendor/bin/testbench route:list
Project structure
โโโ src/ # Package source code
โ โโโ DevToolServiceProvider.php
โ โโโ Commands/ # Rewritten make: commands
โ โโโ MakeResourceCommand.php
โ โโโ MakeFieldCommand.php
โ โโโ MakeTableCommand.php
โ โโโ ...
โโโ workbench/ # Laravel skeleton app for testing
โ โโโ app/
โ โโโ database/
โ โโโ routes/
โโโ vendor/ # Dependencies
โโโ canvas.yaml # Orchestra Canvas configuration
โโโ testbench.yaml # Orchestra Testbench configuration
โโโ compose.yml # Docker Compose for Sail
โโโ install.sh # Installation script
License
MIT License ยฉ Joserick