From d7da0ff054a12282afabfe2114c85b04d93b3b34 Mon Sep 17 00:00:00 2001 From: Leandro Ferreira Date: Tue, 15 Jul 2025 18:04:19 -0300 Subject: [PATCH 1/6] docs: rename files --- docs/01-introduction/{03-help.md => 04-help.md} | 0 ...{04-version-support-policy.md => 05-version-support-policy.md} | 0 docs/01-introduction/{05-contributing.md => 06-contributing.md} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename docs/01-introduction/{03-help.md => 04-help.md} (100%) rename docs/01-introduction/{04-version-support-policy.md => 05-version-support-policy.md} (100%) rename docs/01-introduction/{05-contributing.md => 06-contributing.md} (100%) diff --git a/docs/01-introduction/03-help.md b/docs/01-introduction/04-help.md similarity index 100% rename from docs/01-introduction/03-help.md rename to docs/01-introduction/04-help.md diff --git a/docs/01-introduction/04-version-support-policy.md b/docs/01-introduction/05-version-support-policy.md similarity index 100% rename from docs/01-introduction/04-version-support-policy.md rename to docs/01-introduction/05-version-support-policy.md diff --git a/docs/01-introduction/05-contributing.md b/docs/01-introduction/06-contributing.md similarity index 100% rename from docs/01-introduction/05-contributing.md rename to docs/01-introduction/06-contributing.md From 4f2ddd9f8f227d0cbc527497fb747e91b2a37b81 Mon Sep 17 00:00:00 2001 From: Leandro Ferreira Date: Tue, 15 Jul 2025 18:04:46 -0300 Subject: [PATCH 2/6] docs: add section on optimizing local development --- .../03-optimizing-local-dev.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 docs/01-introduction/03-optimizing-local-dev.md diff --git a/docs/01-introduction/03-optimizing-local-dev.md b/docs/01-introduction/03-optimizing-local-dev.md new file mode 100644 index 0000000000..3ddfa02261 --- /dev/null +++ b/docs/01-introduction/03-optimizing-local-dev.md @@ -0,0 +1,76 @@ +--- +title: Optimizing local dev +--- +import Aside from "@components/Aside.astro" + +This section includes optional tips to improve performance and developer experience when running your Laravel app locally. + +If you're looking for production-specific optimizations, check out [Deploying to production](../deployment). + +## Enabling OPcache + +[OPcache](https://www.php.net/manual/en/book.opcache.php) improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request. + +To check if [OPcache](https://www.php.net/manual/en/book.opcache.php) is enabled, run: + +```bash +php -r "echo 'opcache.enable => ' . ini_get('opcache.enable') . PHP_EOL;" +``` + +You should see `opcache.enable => 1`. If not, enable it by adding the following line to your `php.ini`: + +```ini +opcache.enable=1 # Enable OPcache +``` + +### Optional OPcache settings + +If you're experiencing slow response times or suspect that OPcache is running out of space, you can adjust these parameters in your `php.ini` file: + +```ini +opcache.memory_consumption=128 +opcache.max_accelerated_files=10000 +``` + +- `opcache.memory_consumption`: defines how much memory (in megabytes) OPcache can use to store precompiled PHP code. You can try setting this to `128` and adjust based on your project's needs. +- `opcache.max_accelerated_files`: sets the maximum number of PHP files that OPcache can cache. You can try `10000` as a starting point and increase if your application includes a large number of files. + +These settings are optional but useful if you're troubleshooting performance or working on a large Laravel app. + +## Disabling view debugging in Laravel Herd + +[Laravel Herd](https://herd.laravel.com/) includes a view debugging tool for [macOS](https://herd.laravel.com/docs/macos/debugging/dumps#views) and [Windows](https://herd.laravel.com/docs/windows/debugging/dumps#views). +It shows which views were rendered and what data was passed to them during a request. + +While helpful for debugging, this feature can significantly slow down your app. If you're not actively using it, it's best to turn it off. + +To disable view debugging in Herd: +- Open Herd > Dumps. +- Click Settings. +- Uncheck the "Views" option. + +## Disabling Xdebug +[Xdebug](https://xdebug.org/) is a powerful tool for debugging, but it can slow down performance. If you notice performance issues, check if `Xdebug` is installed and consider disabling it. + +## Caching Blade icons + +Caching [Blade icons](https://blade-ui-kit.com/blade-icons) can help improve performance during local development, especially on views that include many icons. + +To enable caching, run: + +```bash +php artisan icons:cache +``` + +## Disabling Debugbar + +While useful for debugging, [Laravel Debugbar](https://github.com/barryvdh/laravel-debugbar) can slow down your application, especially on complex pages, because it collects and renders a large amount of data on each request. + +If you're noticing slowness, try disabling it by adding the following line to your `.env` file: + +```dotenv +DEBUGBAR_ENABLED=false +``` + +If you still need Debugbar for development, consider disabling specific collectors you're not using. +Refer to the [Debugbar documentation](https://github.com/barryvdh/laravel-debugbar?tab=readme-ov-file#debugbar-for-laravel) for details. From cc4cad9fe73750f28fa0daec4e6fc1673b2f12c9 Mon Sep 17 00:00:00 2001 From: Leandro Ferreira Date: Tue, 15 Jul 2025 18:05:00 -0300 Subject: [PATCH 3/6] docs: add tips for optimizing local development and enabling OPcache --- docs/13-deployment.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/13-deployment.md b/docs/13-deployment.md index 7c7718378d..13a6b51460 100644 --- a/docs/13-deployment.md +++ b/docs/13-deployment.md @@ -7,6 +7,8 @@ import Aside from "@components/Aside.astro" Deploying a Laravel app using Filament to production is similar to deploying any other Laravel app. However, there are a few additional steps you should take to ensure that your Filament panel is optimized for performance and security. +For tips focused on local development performance, see [Optimizing local dev](introduction/optimizing-local-dev). + ## Ensure that users are authorized to access panels When Filament detects that your app's `APP_ENV` is not `local`, it will require you to set up authorization for your users. This is to ensure that only authorized users can access your Filament panel in production, while keeping the local environment easy to get started with. @@ -49,6 +51,18 @@ If you're not using the [`filament:optimize` command](#optimizing-filament-for-p ### Enabling OPcache on your server +To check if [OPcache](https://www.php.net/manual/en/book.opcache.php) is enabled, run: + +```bash +php -r "echo 'opcache.enable => ' . ini_get('opcache.enable') . PHP_EOL;" +``` + +You should see `opcache.enable => 1`. If not, enable it by adding the following line to your `php.ini`: + +```ini +opcache.enable=1 # Enable OPcache +``` + From the [Laravel Forge documentation](https://forge.laravel.com/docs/servers/php.html#opcache):