# vlucas/phpdotenv

Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.

Repository: https://github.com/vlucas/phpdotenv
Canonical: https://ross.abutalabs.com/products/phpdotenv
Language: PHP
License: BSD-3-Clause
License Family: permissive
Topics: hacktoberfest, php, environment, dotenv, environment-variables, configuration
Last push: 2026-08-24T18:09:11+00:00

## Health v2 (maintenance only)
Score: 88/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 67, longevity 100
- inputs: {"age_days": 4970, "days_push": 9, "days_rel": 9, "gap_med": 190, "n_releases_24m": 4}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 13550, forks 663 (observed 2026-08-28T04:11:03.523026+00:00)

## What it is
PHP dotenv is a Composer library that loads environment variables from a `.env` file into `$_ENV`, `$_SERVER`, and optionally `getenv()`. It implements the twelve-factor app practice of keeping configuration such as credentials out of source code.

## Use cases
- load environment variables from a .env file in php
- keep database credentials out of source code
- configure a php app per deployment environment
- avoid editing apache or nginx virtual hosts for config
- share required env values with a .env.example file

## When to choose
- you build PHP applications and want twelve-factor style environment configuration
- you need the same env vars set across Apache, Nginx, CLI, and PHP's built-in server
- you want a battle-tested, widely adopted dotenv implementation for PHP

## When to avoid
- your runtime already loads .env files natively
- you need secrets management with encryption or a vault rather than plain files
- you are not working in PHP

## Facets
- artifact type: library
- maturity: stable
- function: configuration-management, developer-tools
- domain: developer-tools, web-development, backend
- platform: php, cli
- tags: dotenv, environment-variables, twelve-factor, composer, web-server

## Member repositories
- vlucas/phpdotenv (main) score 88

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:11:03.523026+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:13:13.266593+00:00, confidence not recorded.
  - readme: https://github.com/vlucas/phpdotenv (fetched 2026-08-28T04:11:03.523026+00:00, sha 9c20405ff69c)
- Data as of 2026-08-30T08:39:29.467469+00:00.
