{"id":20916186,"url":"https://github.com/yannoff/composer-dotenv-handler","last_synced_at":"2026-04-21T23:01:41.762Z","repository":{"id":57086004,"uuid":"170885826","full_name":"yannoff/composer-dotenv-handler","owner":"yannoff","description":"Composer add-on script to manage .env file easily","archived":false,"fork":false,"pushed_at":"2021-12-20T20:23:02.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-31T17:53:14.547Z","etag":null,"topics":["composer","composer-scripts","dotenv","env","environment-variables"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/yannoff/composer-dotenv-handler","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/yannoff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-15T15:26:45.000Z","updated_at":"2021-10-06T15:01:05.000Z","dependencies_parsed_at":"2022-08-24T22:50:31.640Z","dependency_job_id":null,"html_url":"https://github.com/yannoff/composer-dotenv-handler","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/yannoff/composer-dotenv-handler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannoff%2Fcomposer-dotenv-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannoff%2Fcomposer-dotenv-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannoff%2Fcomposer-dotenv-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannoff%2Fcomposer-dotenv-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yannoff","download_url":"https://codeload.github.com/yannoff/composer-dotenv-handler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yannoff%2Fcomposer-dotenv-handler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32113748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T11:25:29.218Z","status":"ssl_error","status_checked_at":"2026-04-21T11:25:28.499Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["composer","composer-scripts","dotenv","env","environment-variables"],"created_at":"2024-11-18T16:20:19.822Z","updated_at":"2026-04-21T23:01:41.744Z","avatar_url":"https://github.com/yannoff.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yannoff/composer-dotenv-handler\n\n[![Latest Stable Version](https://poser.pugx.org/yannoff/composer-dotenv-handler/v/stable)](https://packagist.org/packages/yannoff/composer-dotenv-handler)\n[![Total Downloads](https://poser.pugx.org/yannoff/composer-dotenv-handler/downloads)](https://packagist.org/packages/yannoff/composer-dotenv-handler)\n[![License](https://poser.pugx.org/yannoff/composer-dotenv-handler/license)](https://packagist.org/packages/yannoff/composer-dotenv-handler)\n\nComposer script to handle `.env` file maintenance, based upon the concept of the popular [incenteev/composer-parameter-handler](https://github.com/Incenteev/ParameterHandler) package.\n\n## Usage\n\nFirst you must require the package:\n\n```bash\n$ composer require yannoff/composer-dotenv-handler\n```\n\nThen, set up your `composer.json` accordingly, as in the following example:\n\n```json\n...\n    \"scripts\": {\n        \"post-install-cmd\": \"Yannoff\\\\DotenvHandler\\\\ScriptHandler::updateEnvFile\"\n    }\n...\n\n```\n\n## Advanced options\n\nOptions may be passed via the `extra` section of the composer.json :\n\n```yaml\n    \"extra\": {\n        \"yannoff-dotenv-handler\": {\n            // options here\n        }\n    }\n```\n\n### Available options\n\n|**Name**     |**Default value**|**Description**\n|-----------|---------------|--------------\n|file         | .env            |The name of the auto-generated *dotenv* file\n|dist-file    | .env.dist       |The name of the template file (the *dist* file)\n|keep-outdated| true            |Keep values in the *env file* that are not anymore in the *dist file*\n|behavior     |normal           |If set to **flex**, enable support for Symfony Flex applications (see [next section](#symfony-flex-behavior) for details)\n\n### Symfony Flex Behavior\n\nAs of November 2018, the guys at Symfony decided to [change radically](https://symfony.com/doc/current/configuration/dot-env-changes.html) how `dotenv` files are handled in symfony applications.\n\nA **local** _temporary workaround_ could be to modify the `composer.json` extra section as follow:\n\n```yaml\n    \"extra\": {\n        \"yannoff-dotenv-handler\": {\n            \"file\": \".env.local\",\n            \"dist-file\": \".env\"\n        }\n    }\n```\nAnyway this is not an acceptable solution, indeed the _dotenv file name_ may vary from one deploy environment to another (test, staging, prod...): the `composer.json` can't be committed as is.\n\n_So here comes the behavior option:_\n\n```yaml\n    \"extra\": {\n        \"yannoff-dotenv-handler\": {\n            \"behavior\": \"flex\"\n        }\n    }\n```\n\nWhen in **flex behavior mode**, the script will build the **dotenv file name** automatically, based upon either the `APP_ENV` or `ENV` (in this order of preference) environment variable (will use _local_ as default value, if not set) at runtime.\n\n_For example, issuing the following command in a terminal:_\n\n```bash\n$ /usr/bin/env ENV=staging composer install\n```\n\n_would result in having the following config values:_\n\n- `dist-file` : `.env`\n- `file` : `.env.staging`\n\n## Licence\n\nLicensed under the [MIT Licence](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyannoff%2Fcomposer-dotenv-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyannoff%2Fcomposer-dotenv-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyannoff%2Fcomposer-dotenv-handler/lists"}