filament/upgrade
Automate Filament upgrades in your Laravel app. Guides you through version changes, checks dependencies, and applies recommended updates so you can move between Filament releases faster with fewer manual steps.
Installation Add the package via Composer:
composer require filament/upgrade
Publish the config file (if needed):
php artisan vendor:publish --provider="Filament\Upgrade\UpgradeServiceProvider"
First Use Case Run the upgrade command to analyze your Filament v4 codebase:
php artisan filament:upgrade:analyze
This generates a report (storage/logs/filament-upgrade-report.log) identifying deprecated or incompatible code.
Where to Look First
Widget, Card, Table → filament/widgets/ namespace).Form, Table → filament/forms/ and filament/tables/).Authorizable → filament/actions/).Analyze Before Upgrading
Use filament:upgrade:analyze to scan your codebase for:
Filament\Tables\Columns\TextColumn → Filament\Tables\Columns\TextColumn with updated traits).config/filament.php → v5 structure).Incremental Upgrades
--dry-run flag to preview changes without modifying files:
php artisan filament:upgrade:fix --dry-run
Automated Fixes Run the fixer to apply common upgrades:
php artisan filament:upgrade:fix
Filament\Widgets\StatsOverviewWidget → App\Filament\Widgets\StatsOverviewWidget).getTable() → getTableDefinition()).resources/views/filament/ → updated includes).Manual Overrides For complex cases (e.g., custom widgets), manually:
filament/forms/Components/TextInput).@form, @table).filament:table with filament:resource for resources.Testing Workflow
php artisan filament:upgrade:test to validate fixes (if supported in future versions).spatie/laravel-permission, livewire/livewire).# Example GitHub Actions step
- run: composer require filament/upgrade && php artisan filament:upgrade:analyze
filament/tables column updates).False Positives/Negatives
php artisan optimize:clear to refresh cached routes.Namespace Collisions
filament:upgrade:fix.Blade Template Breaks
@filamentTable) won’t work in v5.php artisan filament:upgrade:fix --blade to update templates.Policy/Authorization Changes
authorize() in v4 may not map 1:1 to v5’s canAccess().app/Policies/ for Filament-specific logic.Plugin Incompatibility
storage/logs/filament-upgrade-*.log for errors.-v for detailed output:
php artisan filament:upgrade:fix -v
panels, resources).
// v4
'widgets' => [...],
// v5
'panels' => [
'default' => [
'widgets' => [...],
],
],
AppServiceProvider:
public function boot(): void
{
Filament::registerPanel(
Panel::make()
->id('admin')
->path('admin')
->login()
);
}
Custom Fixers Extend the upgrade logic by creating a custom fixer:
// app/Providers/FilamentUpgradeServiceProvider.php
public function boot(): void
{
Upgrade::extend(function (Upgrade $upgrade) {
$upgrade->addFixer(new class {
public function fix(string $file): void
{
// Custom logic here
}
});
});
}
Pre/Post-Upgrade Hooks
Use Laravel’s booted event to run logic after upgrades:
public function booted(): void
{
if (app()->environment('production')) {
// Post-upgrade checks
}
}
Community Patches Contribute fixes to the Filament Upgrade GitHub for shared improvements.
How can I help you explore Laravel packages today?