vencakrecl / nette-env
ENV variables helper for Nette framework
1.0.1
2020-01-19 10:03 UTC
Requires
- php: >=5.6
- nette/di: ^2.3
Requires (Dev)
- phpunit/phpunit: ^5.7.9
This package is auto-updated.
Last update: 2025-04-19 22:02:12 UTC
README
Installation
composer install vencakrecl/nette-env
Usage
- bootstrap.php
use Nette\Configurator; use NetteEnv\NetteEnv; $configurator = new Configurator(); $envs = new NetteEnv(); $envs ->add('MYSQL_HOST', 'mariadb') ->add('MYSQL_PORT', '3306') ->add('MYSQL_USER', 'root') ->add('MYSQL_PASSWORD', 'root') ->add('MYSQL_DBNAME', 'test'); $configurator->addDynamicParameters($envs->getEnvs());
- config.neon
database: dsn: 'mysql:host=%MYSQL_HOST%:%MYSQL_PORT%;dbname=%MYSQL_DBNAME%' user: %MYSQL_USER% password: %MYSQL_PASSWORD%