Skip to content

Conversation

mohsinaliryk
Copy link
Contributor

Clarify env() behavior after configuration caching The current documentation states that “all calls to the env function will return null” once the configuration has been cached.

However, this is only true for environment variables defined exclusively in the .env file.

If the environment variable exists at the system level (e.g., via putenv(), server configuration, env() will still return a value after caching.

This clarification helps developers understand that env() is not completely disabled after config:cache, but rather depends on the source of the environment variable.

Clarify env() behavior after configuration caching
The current documentation states that “all calls to the env function will return null” once the configuration has been cached.

However, this is only true for environment variables defined exclusively in the .env file.

If the environment variable exists at the system level (e.g., via putenv(), server configuration, env() will still return a value after caching.

This clarification helps developers understand that env() is not completely disabled after config:cache, but rather depends on the source of the environment variable.
@taylorotwell taylorotwell merged commit b398efb into laravel:12.x Jun 18, 2025
@mohsinaliryk mohsinaliryk deleted the patch-1 branch June 18, 2025 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants