{"id":16616525,"url":"https://github.com/chillerlan/php-dotenv","last_synced_at":"2025-07-16T04:40:26.755Z","repository":{"id":62501747,"uuid":"147755757","full_name":"chillerlan/php-dotenv","owner":"chillerlan","description":"Load .env files into the environment. PHP 7.4+","archived":false,"fork":false,"pushed_at":"2024-03-07T20:42:07.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-18T05:47:59.627Z","etag":null,"topics":["dotenv","dotenv-loader","env","environment-variables","php","php-library","php7","php8"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chillerlan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"codemasher","custom":"https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4"}},"created_at":"2018-09-07T01:49:21.000Z","updated_at":"2022-08-03T05:23:58.000Z","dependencies_parsed_at":"2024-03-07T21:46:24.912Z","dependency_job_id":null,"html_url":"https://github.com/chillerlan/php-dotenv","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":"0.050000000000000044","last_synced_commit":"0635a71d492b322b796e9db733e06a9978543dd3"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chillerlan%2Fphp-dotenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chillerlan%2Fphp-dotenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chillerlan%2Fphp-dotenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chillerlan%2Fphp-dotenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chillerlan","download_url":"https://codeload.github.com/chillerlan/php-dotenv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242958311,"owners_count":20212771,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotenv","dotenv-loader","env","environment-variables","php","php-library","php7","php8"],"created_at":"2024-10-12T02:13:22.595Z","updated_at":"2025-03-11T02:27:18.380Z","avatar_url":"https://github.com/chillerlan.png","language":"PHP","funding_links":["https://ko-fi.com/codemasher","https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4"],"categories":[],"sub_categories":[],"readme":"# php-dotenv\n\nLoads contents from a `.env` file into the environment. PHP 8.1+\n\n[![PHP Version Support][php-badge]][php]\n[![version][packagist-badge]][packagist]\n[![license][license-badge]][license]\n[![Coverage][coverage-badge]][coverage]\n[![Packagist downloads][downloads-badge]][downloads]\n[![CI][gh-action-badge]][gh-action]\n\n[php-badge]: https://img.shields.io/packagist/php-v/chillerlan/php-dotenv?logo=php\u0026color=8892BF\n[php]: https://www.php.net/supported-versions.php\n[packagist-badge]: https://img.shields.io/packagist/v/chillerlan/php-dotenv.svg?logo=packagist\n[packagist]: https://packagist.org/packages/chillerlan/php-dotenv\n[license-badge]: https://img.shields.io/github/license/chillerlan/php-dotenv.svg\n[license]: https://github.com/chillerlan/php-dotenv/blob/master/LICENSE\n[coverage-badge]: https://img.shields.io/codecov/c/github/chillerlan/php-dotenv.svg?logo=codecov\n[coverage]: https://codecov.io/github/chillerlan/php-dotenv\n[scrutinizer-badge]: https://img.shields.io/scrutinizer/g/chillerlan/php-dotenv.svg?logo=scrutinizer\n[scrutinizer]: https://scrutinizer-ci.com/g/chillerlan/php-dotenv\n[downloads-badge]: https://img.shields.io/packagist/dt/chillerlan/php-dotenv.svg?logo=packagist\n[downloads]: https://packagist.org/packages/chillerlan/php-dotenv/stats\n[gh-action-badge]: https://github.com/chillerlan/php-dotenv/workflows/CI/badge.svg\n[gh-action]: https://github.com/chillerlan/php-dotenv/actions?query=workflow%3A%22CI%22\n\n# Documentation\n\n## Installation\n**requires [composer](https://getcomposer.org)**\n\n*composer.json* (note: replace `dev-main` with a [version constraint](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints), e.g. `^3.0`)\n\n```json\n{\n\t\"require\": {\n\t\t\"php\": \"^8.1\",\n\t\t\"chillerlan/php-dotenv\": \"dev-main\"\n\t}\n}\n```\n\nInstallation via terminal: `composer require chillerlan/php-dotenv`\n\nProfit!\n\n## Usage\n\n```\n# example .env\nFOO=bar\nBAR=foo\nWHAT=${BAR}-${FOO}\n```\n\n```php\n$env = new DotEnv(__DIR__.'/../config', '.env');\n$env-\u003eload(['foo']); // foo is required\n\n// get a variable\n$foo = $_ENV['FOO']; // -\u003e bar\n$foo = $env-\u003eget('FOO'); // -\u003e bar\n$foo = $env-\u003eFOO; // -\u003e bar\n\n// dynamically set a variable\n$env-\u003eset('foo', 'whatever');\n$env-\u003eFOO = 'whatever';\n\n$foo = $env-\u003eget('FOO'); // -\u003e whatever\n// ...\n\n// variable substitution\n$foo = $env-\u003eget('WHAT'); // -\u003e foo-bar\n```\n\n```php\n// avoid the global environment\n$env = (new DotEnv(__DIR__.'/../config', '.env', false))-\u003eload();\n\n$foo = $_ENV['FOO']; // -\u003e undefined\n$foo = $env-\u003eget('FOO'); // -\u003e bar\n$foo = $env-\u003eFOO; // -\u003e bar\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchillerlan%2Fphp-dotenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchillerlan%2Fphp-dotenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchillerlan%2Fphp-dotenv/lists"}