{"id":14985389,"url":"https://github.com/incenteev/parameterhandler","last_synced_at":"2025-05-14T10:07:32.446Z","repository":{"id":5154161,"uuid":"6322277","full_name":"Incenteev/ParameterHandler","owner":"Incenteev","description":"Composer script handling your ignored parameter file","archived":false,"fork":false,"pushed_at":"2023-12-09T10:31:49.000Z","size":72,"stargazers_count":928,"open_issues_count":33,"forks_count":99,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-31T15:42:37.041Z","etag":null,"topics":["composer","composer-scripts","environment-variables","ignored-parameters","yaml"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"moteus/lua-sendmail","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Incenteev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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}},"created_at":"2012-10-21T16:08:04.000Z","updated_at":"2025-03-26T09:45:17.000Z","dependencies_parsed_at":"2024-01-12T11:51:46.562Z","dependency_job_id":"1c9136ca-cd0b-4b1f-b0db-6d63851e13fa","html_url":"https://github.com/Incenteev/ParameterHandler","commit_stats":{"total_commits":84,"total_committers":24,"mean_commits":3.5,"dds":"0.48809523809523814","last_synced_commit":"90bffce926e96b365579a2ef024aab457f4b80c5"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Incenteev%2FParameterHandler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Incenteev%2FParameterHandler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Incenteev%2FParameterHandler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Incenteev%2FParameterHandler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Incenteev","download_url":"https://codeload.github.com/Incenteev/ParameterHandler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248335648,"owners_count":21086632,"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":["composer","composer-scripts","environment-variables","ignored-parameters","yaml"],"created_at":"2024-09-24T14:10:51.809Z","updated_at":"2025-04-11T03:32:54.294Z","avatar_url":"https://github.com/Incenteev.png","language":"PHP","readme":"# Managing your ignored parameters with Composer\n\nThis tool allows you to manage your ignored parameters when running a composer\ninstall or update. It works when storing the parameters in a Yaml file under\na single top-level key (named ``parameters`` by default). Other keys are\ncopied without change.\n\n[![CI](https://github.com/Incenteev/ParameterHandler/actions/workflows/ci.yaml/badge.svg)](https://github.com/Incenteev/ParameterHandler/actions/workflows/ci.yaml)\n[![Latest Stable Version](https://poser.pugx.org/incenteev/composer-parameter-handler/v/stable.png)](https://packagist.org/packages/incenteev/composer-parameter-handler)\n[![Latest Unstable Version](https://poser.pugx.org/incenteev/composer-parameter-handler/v/unstable.png)](https://packagist.org/packages/incenteev/composer-parameter-handler)\n\n## Usage\n\nAdd the following in your root composer.json file:\n\n```json\n{\n    \"require\": {\n        \"incenteev/composer-parameter-handler\": \"~2.0\"\n    },\n    \"scripts\": {\n        \"post-install-cmd\": [\n            \"Incenteev\\\\ParameterHandler\\\\ScriptHandler::buildParameters\"\n        ],\n        \"post-update-cmd\": [\n            \"Incenteev\\\\ParameterHandler\\\\ScriptHandler::buildParameters\"\n        ]\n    },\n    \"extra\": {\n        \"incenteev-parameters\": {\n            \"file\": \"app/config/parameters.yml\"\n        }\n    }\n}\n```\n\nThe ``app/config/parameters.yml`` will then be created or updated by the\ncomposer script, to match the structure of the dist file ``app/config/parameters.yml.dist``\nby asking you the missing parameters.\n\nBy default, the dist file is assumed to be in the same place than the parameters\nfile, suffixed by ``.dist``. This can be changed in the configuration:\n\n```json\n{\n    \"extra\": {\n        \"incenteev-parameters\": {\n            \"file\": \"app/config/parameters.yml\",\n            \"dist-file\": \"some/other/folder/to/other/parameters/file/parameters.yml.dist\"\n        }\n    }\n}\n```\n\nThe script handler will ask you interactively for parameters which are missing\nin the parameters file, using the value of the dist file as default value.\nAll prompted values are parsed as inline Yaml, to allow you to define ``true``,\n``false``, ``null`` or numbers easily.\nIf composer is run in a non-interactive mode, the values of the dist file\nwill be used for missing parameters.\n\n**Warning:** This parameters handler will overwrite any comments or spaces into\nyour parameters.yml file so handle with care. If you want to give format\nand comments to your parameter's file you should do it on your dist version.\n\n### Keeping outdated parameters\n\nWarning: This script removes outdated params from ``parameters.yml`` which are not in ``parameters.yml.dist``\nIf you need to keep outdated params you can use `keep-outdated` param in the configuration:\n\n```json\n{\n    \"extra\": {\n        \"incenteev-parameters\": {\n            \"keep-outdated\": true\n        }\n    }\n}\n```\n\n### Using a different top-level key\n\nThe script handler looks for a ``parameters`` key in your dist file.  You can change this by using the\n`parameter-key` param in the configuration:\n```json\n{\n    \"extra\": {\n        \"incenteev-parameters\": {\n            \"parameter-key\": \"config\"\n        }\n    }\n}\n```\n\n### Using environment variables to set the parameters\n\nFor your prod environment, using an interactive prompt may not be possible\nwhen deploying. In this case, you can rely on environment variables to provide\nthe parameters. This is achieved by providing a map between environment variables\nand the parameters they should fill:\n\n```json\n{\n    \"extra\": {\n        \"incenteev-parameters\": {\n            \"env-map\": {\n                \"my_first_param\": \"MY_FIRST_PARAM\",\n                \"my_second_param\": \"MY_SECOND_PARAM\"\n            }\n        }\n    }\n}\n```\n\nIf an environment variable is set, its value will always replace the value\nset in the existing parameters file.\n\nAs environment variables can only be strings, they are also parsed as inline\nYaml values to allows specifying ``null``, ``false``, ``true`` or numbers\neasily.\n\n### Renaming parameters\n\nIf you are renaming a parameter, the new key will be set according to the usual\nroutine (prompt if possible, use environment variables, use default).\nTo have the parameters handler use the value of an (obsolete) parameter, specify\na rename-map:\n```json\n{\n    \"extra\": {\n        \"incenteev-parameters\": {\n            \"rename-map\": {\n                \"new_param_1\": \"old_param_1\",\n                \"new_param_2\": \"old_param_2\"\n            }\n        }\n    }\n}\n```\n\nThis will create the new parameters new_param_1 and new_param_2 while using the\nvalues from old_param_1 and old_param_2, respectively. It will not remove the\nold parameters unless you've also removed them from the dist version.\n\nIf the old parameter is no longer present (maybe because it has been renamed and\nremoved already), no parameters are overwritten. You don't need to remove obsolete\nparameters from the rename map once they have been renamed.\n\n### Managing multiple ignored files\n\nThe parameter handler can manage multiple ignored files. To use this feature,\nthe ``incenteev-parameters`` extra should contain a JSON array with multiple\nconfigurations inside it instead of a configuration object:\n\n```json\n{\n    \"extra\": {\n        \"incenteev-parameters\": [\n            {\n                \"file\": \"app/config/parameters.yml\",\n                \"env-map\": {}\n            },\n            {\n                \"file\": \"app/config/databases.yml\",\n                \"dist-file\": \"app/config/databases.dist.yml\",\n                \"parameter-key\": \"config\"\n            }\n        ]\n    }\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fincenteev%2Fparameterhandler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fincenteev%2Fparameterhandler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fincenteev%2Fparameterhandler/lists"}