gitmyhub

dotenv

PHP ★ 3.8k updated 16d ago

Registers environment variables from a .env file

This is a PHP library that reads configuration values from a special file called .env and makes them available to your application at runtime. The .env file is a plain text file where you store things like database passwords, API keys, or other settings that should not be hardcoded directly in your code.

When your application starts, this library loads the .env file and places those values into PHP's built-in environment containers so the rest of your code can read them. You can load one file or several files at once, and there is an option to overwrite values that were already set before the library ran.

It also supports a layered loading approach where different files apply depending on what environment your app is running in, such as development or production. This makes it straightforward to keep local settings separate from what gets deployed to a server.

The library is published as a Symfony component and is installed via Composer, PHP's standard package manager. The README is intentionally short because this is a focused, single-purpose tool with no complex setup.