公告: 旧版文档请移步 -> http://v2.laravel-filament.cn/docs

Languages

Version

Theme

Notifications

Upgrading from v2.x

If you see anything missing from this guide, please do not hesitate to make a pull request to our repository! Any help is appreciated!

New requirements

  • Laravel v10.0+
  • Livewire v3.0+

Please upgrade Filament before upgrading to Livewire v3. Instructions on how to upgrade Livewire can be found here.

Upgrading automatically

The easiest way to upgrade your app is to run the automated upgrade script. This script will automatically upgrade your application to the latest version of Filament, and make changes to your code which handle most breaking changes.

composer require filament/upgrade:"^3.2" -W --dev
vendor/bin/filament-v3

Make sure to carefully follow the instructions, and review the changes made by the script. You may need to make some manual changes to your code afterwards, but the script should handle most of the repetitive work for you.

Finally, you must run php artisan filament:install to finalize the Filament v3 installation. This command must be run for all new Filament projects.

You can now composer remove filament/upgrade as you don't need it anymore.

Some plugins you're using may not be available in v3 just yet. You could temporarily remove them from your composer.json file until they've been upgraded, replace them with a similar plugins that are v3-compatible, wait for the plugins to be upgraded before upgrading your app, or even write PRs to help the authors upgrade them.

Upgrading manually

After upgrading the dependency via Composer, you should execute php artisan filament:upgrade in order to clear any Laravel caches and publish the new frontend assets.

High-impact changes

Config file renamed and combined with other Filament packages

Only one config file is now used for all Filament packages. Most configuration has been moved into other parts of the codebase, and little remains. You should use the v3 documentation as a reference when replace the configuration options you did modify. To publish the new configuration file and remove the old one, run:

php artisan vendor:publish --tag=filament-config --force
rm config/notifications.php

New @filamentScripts and @filamentStyles Blade directives

The @filamentScripts and @filamentStyles Blade directives must be added to your Blade layout file/s. Since Livewire v3 no longer uses similar directives, you can replace @livewireScripts with @filamentScripts and @livewireStyles with @filamentStyles.

JavaScript assets

You no longer need to import the NotificationsAlpinePlugin in your JavaScript files. Alpine plugins are now automatically loaded by @filamentScripts.

Heroicons have been updated to v2

The Heroicons library has been updated to v2. This means that any icons you use in your app may have changed names. You can find a list of changes here.

Medium-impact changes

Secondary color

Filament v2 had a secondary color for many components which was gray. All references to secondary should be replaced with gray to preserve the same appearance. This frees secondary to be registered to a new custom color of your choice.

Notification JS objects

The Notification JavaScript object has been renamed to FilamentNotification to avoid conflicts with the native browser Notification object. The same has been done for NotificationAction (now FilamentNotificationAction) and NotificationActionGroup (now FilamentNotificationActionGroup) for consistency.

Edit on GitHub

Still need help? Join our Discord community or open a GitHub discussion

上一页
Testing