Forked from https://gist.github.com/eric1234/5628416
Adjustments:
- No environment based .env filenames
- No need for APP_ENV
Somewhat like dotenv but for PHP.
The goals is to remove all config scattered about in files and have
one authoritative source for that config info. Searches for .env
up the directory tree until it gets to DOCUMENT_ROOT.
Create a .env
file in the root of your website. In that
file put all configuration. Example:
DB_DSN=mysql:dbname=mydb;host=myhost
DB_USERNAME=myuser
DB_PASSWORD=mypass
Then in your code you can simply access these values via the $_ENV global.