Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Surajshetty's avatar

How to boost the performance in filament

Because after installing filament into my project, it's getting a bit slow, so are there any configurations or some tips that can help me?

0 likes
11 replies
LaryAI's avatar
Level 58

Filament, as a Laravel package, can sometimes slow down your application if not optimized properly. Here are some tips to boost performance when using Filament in your Laravel project:

  1. Cache Configuration and Routes: Laravel provides a powerful caching system for your configuration and routes. Run the following commands to cache your configuration and routes, which can reduce the application's boot time:

    php artisan config:cache
    php artisan route:cache
    
  2. Optimize Composer Autoload: Composer can optimize the autoloader mapping with the dump-autoload command. This can help improve the performance of your autoloaded classes:

    composer dump-autoload -o
    
  3. Use Lazy Loading: If you're using Eloquent relationships within Filament, make sure to use lazy loading to prevent unnecessary database queries.

  4. Eager Loading: Conversely, if you know you'll need related data, use eager loading with the with() method to reduce the number of queries.

  5. Optimize Queries: Use Laravel's DB::listen method to log and examine your queries. Optimize any queries that are slow or being run multiple times unnecessarily.

  6. Asset Caching: Ensure that your static assets (CSS, JavaScript, images) are being cached by the browser. You can set far-future Expires headers for these assets.

  7. Use a Content Delivery Network (CDN): Serving your assets from a CDN can greatly improve load times for users by distributing the load and serving assets from a location closer to the user.

  8. Profile Your App: Use Laravel Debugbar or Telescope to profile your application and find bottlenecks.

  9. Database Indexing: Make sure that your database tables are properly indexed. Indexes can greatly improve the speed of database queries.

  10. Update Filament and Dependencies: Keep Filament and your other project dependencies up to date. Performance improvements are often made in newer versions of packages.

  11. Use Production Configuration: Ensure that your application is running in production mode, which has optimizations that are not present in the development mode:

    php artisan optimize
    
  12. Reduce Package Usage: Audit your project and remove any unnecessary packages or features that may be slowing down your application.

  13. Compile Assets: If you're using a build tool like Webpack or Laravel Mix, make sure you're compiling your assets for production, which typically includes minification and other optimizations.

Remember that performance tuning can be a complex task and often requires profiling and testing different strategies to find what works best for your specific application.

GregsAccount's avatar

When your site is production-ready, cache your views:

php artisan view:cache

Also, there is a video by Povilas Korop (Laravel Daily). Here, he demonstrates how to find all the things that slow down your site.

Because I can't paste links, I describe the steps to find that short video: Go to Youtube and search for: Filament is Slow? Check Laravel Debugbar.

It is important to know that the debug bar can also slow down your development environment. But you can uninstall or disable it after you finish its usage.

2 likes
jaseofspades88's avatar
Level 51

The biggest issue I found was in the icon usage. Try running php artisan icons:cache as since I have, my application flies.

8 likes
pabbec's avatar

Hi!

I had the same problem. But this week, while reading the Filament documentation, I found this that changed my developer experience with Filament:

https :// filamentphp.com/docs/3.x/panels/installation#improving-filament-panel-performance

Use:

php artisan icons:cache

php artisan filament:cache-components

Please, note that if you create a new component, you will need to run it again.

Filament is now 2x or 3x times faster.

2 likes
mohamadTR's avatar

@pabbec Hello, the command

php artisan filament:cache-components

not working is giving :

ERROR  Command "filament:cache-components" is not defined. Did you mean one of these?
  ⇂ filament-browser:install
  ⇂ filament-developer-gate:install
  ⇂ filament:assets
  ⇂ filament:check-translations
  ⇂ filament:install
  ⇂ filament:upgrade

how I can fix it, thanks on advance

denizaygun's avatar

@pabbec As docs recommended, you will want to add php artisan filament:optimize to your deployment script, which caches filament components and blade icons.

2 likes

Please or to participate in this conversation.