Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse a string containing .env content #41

Open
insanityfarm opened this issue Dec 9, 2017 · 2 comments
Open

Parse a string containing .env content #41

insanityfarm opened this issue Dec 9, 2017 · 2 comments

Comments

@insanityfarm
Copy link

insanityfarm commented Dec 9, 2017

I'd like the php-dotenv library to consume .env content as a string, rather than a file which is read from a path. Is there any way I'm not seeing to do this currently, or could that functionality be added?

@josegonzalez
Copy link
Owner

Doesn't support it, but pull requests are welcome :)

@dubaaron
Copy link

@insanityfarm You might try checking out m1/Env: https://github.com/m1/Env ... it's the underlying parser for this library, and supports passing in a string as opposed to loading from a file directly:

$env = new Parser(file_get_contents('test.env'));
$arr = $env->getContent();

// example 2 -- statically
$arr = Parser::parse(file_get_contents('test.env'));

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

No branches or pull requests

3 participants