vlucas/phpdotenv

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

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 16 minutes ago
Added to GitGenius on September 4th, 2026
Created on January 23rd, 2013
Open Issues & Pull Requests: 2 (+0)
GitHub issues: Enabled
Number of forks: 663
Total Stargazers: 13,551 (+0)
Total Subscribers: 165 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 63.1 days
Mean response time: 215.7 days
90th percentile: 703.4 days
Tracked items: 25

Most active contributors

Sign in to see contributor activity.

How this project is maintained

Around half of the issues opened in the past year never receive a reply. Only 10% of issues opened in the past year have been closed. Three people close 92% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 2
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 11 days
Stale 30+ days: 0
Stale 90+ days: 0

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

No label distribution available yet.

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

PHP dotenv is a library that loads environment variables from a .env file into PHP's $_ENV and $_SERVER superglobals, and optionally into getenv().

The tool solves the problem of managing configuration across different deployment environments without hardcoding sensitive credentials into your codebase. Rather than editing virtual host configurations, .htaccess files, or relying on server-specific setup, PHP dotenv reads a .env file in your project and populates environment variables automatically. This approach works consistently across Apache, Nginx, CLI, and PHP's built-in webserver, making it simple to maintain environment-specific settings like database credentials and API keys without modifying files outside the project.

You should adopt this tool if you follow twelve-factor app principles and want an easy way to manage configuration across development, testing, and production environments. It suits any PHP project that needs to separate configuration from code. The typical workflow involves creating a .env.example file with all required variables (minus sensitive values) that gets committed to version control, while each developer or deployment maintains their own .env file with actual credentials, which stays out of version control via .gitignore. This pattern ensures sensitive data never enters your repository history while making it clear what configuration your application requires.

The project maintains upgrading guides between major versions to help with semantic versioning transitions. Development activity shows consistent attention to code quality and user experience through documentation and structured migration paths.