Skip to content

Array argument to DotEnv constructor #213

Closed
@sminnee

Description

@sminnee

It would be helpful to be able to specify an array of paths in the DotEnv constructor:

$env = new DotEnv([__DIR__, dirname(__DIR__)]);

The semantics would be that the first path that contains a .env file would be used.

The use-case is that sometimes it's better to put .env outside of your project root, e.g. if your project code is deployed separately from .env or if you're using a common .env for multiple projects.

Would you accept a PR to this effect?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions