Skip to content

Extra information's

Azizul Hakim edited this page Oct 20, 2023 · 3 revisions

Performance Tips

Some Performance Tips for Filament

Icon cache

To optimize the performance of the Filament app, you can use the php artisan icons:cache command to cache icons. This command preloads and caches the icons used in your application, resulting in faster load times.

php artisan icons:cache

Disabling View Collection in Debugbar

If you're experiencing performance issues and want to speed up your application, consider disabling the view collection feature in the Debugbar. Here's how you can do it:

  1. Navigate to the debugbar.php configuration file located in the config directory of your app.

  2. Inside the debugbar.php file, you'll find an array named collectors. Locate the 'views' collector within this array.

  3. To disable the view collection, simply set the 'views' collector to false, like this:

'collectors' => [
    ...
    'views' => false,  // Views with their data
],

This change will prevent the Debugbar from collecting and displaying view data, which can help improve the performance of your application, particularly in a development environment.

Extra Artisan Commands

This project provides additional Artisan commands to simplify your workflow and enhance productivity.

Generate IDE Helper Files:

Generate general IDE helper files for improved code autocompletion and navigation by running:

php artisan ide-helper:generate

Generate IDE model helper files without writing to model files using:

#use any one of this two commands
php artisan ide-helper:models -N
php artisan ide-helper:models --nowrite

Run PHP CS Fixer

php artisan csfixer:run

This command ensures that your code adheres to the predefined coding standards, making your codebase clean and readable.

Create a Service

Creating services for your application is made effortless. Use the following command to generate a service:

php artisan make:service subfolder/ServiceName

Replace subfolder and ServiceName with the actual values you need. You can also create a service without a subfolder:

php artisan make:service TestService

The newly created service will be located at app/Http/Services/TestService.php, ready to handle your application's business logic.

Generate a Trait

Traits are reusable code components that enhance code organization. To create a new trait, simply run:

php artisan make:trait TestTrait

This command generates a new trait file for your project, promoting code reusability and maintainability.

Leverage these Artisan commands to streamline your development process and maintain a well-structured codebase.