Skip to content

[Config] Missing example of $_ENV usage for environment variables #17693

Closed
@miqrogroove

Description

@miqrogroove

After reading the Configuration / Environment Variables docs multiple times, I realized the reason it wasn't making sense was that there was no example of using the $_ENV superglobal array in PHP to actually read data from the .env configuration. In fact, the only mention of it was this sentence about halfway through the document:

The .env file is read and parsed on every request and its env vars are added to the $_ENV & $_SERVER PHP variables.

https://symfony.com/doc/5.4/configuration.html

When I found that, it all made perfect sense to me. There should be an obvious example showing how the .env file is intended to be used in PHP app code so that readers don't mistakenly scour the page looking for an API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ConfighasPRA Pull Request has already been submitted for this issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions