Read and use .env files
github.com/nichin79/DotEnv
Source
Issues
Installs: 44
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
None
Requires (Dev)
Suggests
Provides
Conflicts
Replaces
Unknown License e272b03af5a4a59590605ab9cd722fb2219bfe0d
This package is auto-updated.
Last update: 2025-01-07 02:09:13 UTC
Example
require_once __DIR__ . '/../vendor/autoload.php'; (new Nichin79\DotEnv\DotEnv(__DIR__ . '/../.env'))->load(); $config = [ 'dsn' => $_ENV['DB_DSN'], 'user' => $_ENV['DB_USER'], 'pass' => $_ENV['DB_PASS'], ]; var_dump($config); var_dump($_ENV); var_dump($_SERVER);