ZF2 Module that loads vlucas/phpdotenv.
Module attaches a listener to EVENT_LOAD_MODULE
on ModuleManager's EventManager to load environment variables while the module is loaded.
composer require abacaphiliac/zend-phpdotenv
- Add
Abacaphiliac\ZendPhpDotEnv
to your ZF2 application module config. - Create a
.env
file in the root directory of your ZF2 application. - Use
getenv()
anywhere in your code (or config) to pull environment variables.
php >=5.3.9 and ZF >=2
See composer.json.
composer install && vendor/bin/phing
This library attempts to comply with PSR-1, PSR-2, and PSR-4. If you notice compliance oversights, please send a patch via pull request.