From 5efcf18d68a2a4ba8940b14f00bacdfd5cdfcf31 Mon Sep 17 00:00:00 2001 From: Tony Messias Date: Mon, 10 Mar 2025 23:46:31 -0300 Subject: [PATCH 1/2] Adds a mention to autoreloading and using multiple processes --- configuration.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/configuration.md b/configuration.md index 15a870b2d8..058ad4c589 100644 --- a/configuration.md +++ b/configuration.md @@ -4,6 +4,7 @@ - [Environment Configuration](#environment-configuration) - [Environment Variable Types](#environment-variable-types) - [Retrieving Environment Configuration](#retrieving-environment-configuration) + - [Auto-reloading Environment Variables Changes](#auto-reloading-env-changes) - [Determining the Current Environment](#determining-the-current-environment) - [Encrypting Environment Files](#encrypting-environment-files) - [Accessing Configuration Values](#accessing-configuration-values) @@ -103,6 +104,17 @@ All of the variables listed in the `.env` file will be loaded into the `$_ENV` P The second value passed to the `env` function is the "default value". This value will be returned if no environment variable exists for the given key. + +### Auto-reloading Environment Variables Changes + +When serving your application using the `php artisan serve` command, Laravel will automatically detect and apply changes made to your `.env` file without requiring you to restart the development server. You may disable this automatic reloading behavior, you may use the `--no-reload` option when invoking the command: + +```bash +php artisan serve --no-reload +``` + +The auto-reloading behavior is automatically disabled when using the `PHP_CLI_WORKER_SERVERS` configuration to start multiple worker processes. + ### Determining the Current Environment From d6dd5df7c68f839c8216079390d1ac94c2da63cc Mon Sep 17 00:00:00 2001 From: Tony Messias Date: Mon, 10 Mar 2025 23:58:44 -0300 Subject: [PATCH 2/2] Adds line about manually restarting command --- configuration.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configuration.md b/configuration.md index 058ad4c589..e76dbd6cea 100644 --- a/configuration.md +++ b/configuration.md @@ -115,6 +115,8 @@ php artisan serve --no-reload The auto-reloading behavior is automatically disabled when using the `PHP_CLI_WORKER_SERVERS` configuration to start multiple worker processes. +If you have either disabled the behavior or are using multiple processes, you need to manually restart the command when you may changes to the `.env` file. + ### Determining the Current Environment