# PHP dotenv

> Loads environment variables from .env to $_ENV and $_SERVER automagically

Source: https://talira.ai/catalog/php-dotenv-9jdd4vq0
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / configuration](https://talira.ai/categories/libraries/configuration), [developer tools / environment / env vars](https://talira.ai/categories/developer-tools/environment/env-vars), [languages / php](https://talira.ai/categories/languages/php)
- Licence: BSD-3-Clause[^1]
- Pricing: Free[^1]
- Free tier: yes[^1]
- Backed by: [PHP dotenv](https://talira.ai/orgs/phpdotenv.md)

PHP dotenv loads environment variables from a `.env` file into `$_ENV` and `$_SERVER`, and optionally into `getenv()` and `putenv()`, so configuration such as database credentials stays out of the code and works the same under Apache, Nginx, the CLI and PHP's built-in server. It supports immutable loading, several files, nested variable references and built-in validation of required variables. It is a PHP version of Ruby's dotenv.

## Links

- GitHub: https://github.com/phpdotenv/phpdotenv

## Problems it solves

- load settings from a .env file in a PHP app
- keep database credentials out of my PHP code
- fail early when a required environment variable is missing in PHP

## Features

- loads .env into $_ENV and $_SERVER
- optional getenv() and putenv() support
- immutable loading and multiple files
- nested variable references
- validation of required variables

## Trust

Overall: 0.57 out of 1.
Signals: maintenance 0.64, adoption 0.83, momentum 0.58, community 0.74, backing 0.30, extensibility 0.00.

- last commit 7 days ago
- 6 commits in the last 90 days
- latest release v5.8.1 7 days ago
- 13.6k GitHub stars
- 69 contributors
- accepts sponsorship (Github, Tidelift)
- has a company behind it

## Sources

[^1]: https://github.com/phpdotenv/phpdotenv/blob/master/LICENSE (checked 27 Nov 2026)
[^2]: https://github.com/phpdotenv/phpdotenv/blob/master/README.md (checked 27 Nov 2026)
