{"id":13409313,"url":"https://github.com/wikimedia/composer-merge-plugin","last_synced_at":"2025-03-14T14:31:09.563Z","repository":{"id":24908173,"uuid":"28324879","full_name":"wikimedia/composer-merge-plugin","owner":"wikimedia","description":"Merge one or more additional composer.json files at Composer runtime","archived":false,"fork":false,"pushed_at":"2023-10-27T15:34:28.000Z","size":365,"stargazers_count":919,"open_issues_count":68,"forks_count":160,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-05-17T00:01:38.532Z","etag":null,"topics":[],"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/wikimedia.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-12-22T04:50:24.000Z","updated_at":"2024-05-17T00:01:38.533Z","dependencies_parsed_at":"2023-02-10T19:01:46.791Z","dependency_job_id":"32cf0f1c-fcb6-4ad9-9d92-f8bb1ee96c23","html_url":"https://github.com/wikimedia/composer-merge-plugin","commit_stats":{"total_commits":208,"total_committers":25,"mean_commits":8.32,"dds":0.7644230769230769,"last_synced_commit":"ab7cf5e140e23ce603872780ab8b570cfaf9c1f9"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wikimedia%2Fcomposer-merge-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wikimedia%2Fcomposer-merge-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wikimedia%2Fcomposer-merge-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wikimedia%2Fcomposer-merge-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wikimedia","download_url":"https://codeload.github.com/wikimedia/composer-merge-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243593342,"owners_count":20316171,"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":[],"created_at":"2024-07-30T20:00:59.841Z","updated_at":"2025-03-14T14:31:09.192Z","avatar_url":"https://github.com/wikimedia.png","language":"PHP","funding_links":[],"categories":["Table of Contents","Dependency Management Extras","Plugins","PHP","目录","其他的依赖管理 Dependency Management Extras","Ecosystem"],"sub_categories":["Dependency Management Extras","Support","依赖关系管理临时演员 dependency-management-extras","Dependency Management"],"readme":"[![Latest Stable Version]](https://packagist.org/packages/wikimedia/composer-merge-plugin) [![License]](https://github.com/wikimedia/composer-merge-plugin/blob/master/LICENSE)\n[![Build Status]](https://github.com/wikimedia/composer-merge-plugin/actions/workflows/CI.yaml)\n[![Code Coverage]](https://scrutinizer-ci.com/g/wikimedia/composer-merge-plugin/?branch=master)\n\nComposer Merge Plugin\n=====================\n\nMerge multiple composer.json files at [Composer] runtime.\n\nComposer Merge Plugin is intended to allow easier dependency management for\napplications which ship a composer.json file and expect some deployments to\ninstall additional Composer managed libraries. It does this by allowing the\napplication's top level `composer.json` file to provide a list of optional\nadditional configuration files. When Composer is run it will parse these files\nand merge their configuration settings into the base configuration. This\ncombined configuration will then be used when downloading additional libraries\nand generating the autoloader.\n\nComposer Merge Plugin was created to help with installation of [MediaWiki]\nwhich has core library requirements as well as optional libraries and\nextensions which may be managed via Composer.\n\n\nInstallation\n------------\n\nComposer Merge Plugin 1.4.x (and older) requires Composer 1.x.\n\nComposer Merge Plugin 2.0.x (and newer) is compatible with both Composer 2.x and 1.x.\n\n```\n$ composer require wikimedia/composer-merge-plugin\n```\n\n### Upgrading from Composer 1 to 2\n\nIf you are already using Composer Merge Plugin 1.4 (or older) and you are updating the plugin to 2.0 (or newer), it is recommended that you update the plugin first using Composer 1.\n\nIf you update the incompatible plugin using Composer 2, the plugin will be ignored:\n\n\u003e The \"wikimedia/composer-merge-plugin\" plugin was skipped because it requires a Plugin API version (\"^1.0\") that does not match your Composer installation (\"2.0.0\"). You may need to run composer update with the \"--no-plugins\" option.\n\nConsequently, Composer will be unaware of the merged dependencies and will remove them requiring you to run `composer update` again to reinstall merged dependencies.\n\n\nUsage\n-----\n\n```json\n{\n    \"require\": {\n        \"wikimedia/composer-merge-plugin\": \"dev-master\"\n    },\n    \"extra\": {\n        \"merge-plugin\": {\n            \"include\": [\n                \"composer.local.json\",\n                \"extensions/*/composer.json\"\n            ],\n            \"require\": [\n                \"submodule/composer.json\"\n            ],\n            \"recurse\": true,\n            \"replace\": false,\n            \"ignore-duplicates\": false,\n            \"merge-dev\": true,\n            \"merge-extra\": false,\n            \"merge-extra-deep\": false,\n            \"merge-replace\": true,\n            \"merge-scripts\": false\n        }\n    }\n}\n```\n\n### Updating sub-levels `composer.json` files\n\n\nIn order for Composer Merge Plugin to install dependencies from updated or newly created sub-level `composer.json` files in your project you need to run the command:\n\n```\n$ composer update\n```\n\nThis will [instruct Composer to recalculate the file hash](https://getcomposer.org/doc/03-cli.md#update) for the top-level `composer.json` thus triggering Composer Merge Plugin to look for the sub-level configuration files and update your dependencies.\n\n\nPlugin configuration\n--------------------\n\nThe plugin reads its configuration from the `merge-plugin` section of your\ncomposer.json's `extra` section. An `include` setting is required to tell\nComposer Merge Plugin which file(s) to merge.\n\n\n### include\n\nThe `include` setting can specify either a single value or an array of values.\nEach value is treated as a PHP `glob()` pattern identifying additional\ncomposer.json style configuration files to merge into the root package\nconfiguration for the current Composer execution.\n\nThe following sections of the found configuration files will be merged into\nthe Composer root package configuration as though they were directly included\nin the top-level composer.json file:\n\n* [autoload](https://getcomposer.org/doc/04-schema.md#autoload)\n* [autoload-dev](https://getcomposer.org/doc/04-schema.md#autoload-dev)\n  (optional, see [merge-dev](#merge-dev) below)\n* [conflict](https://getcomposer.org/doc/04-schema.md#conflict)\n* [provide](https://getcomposer.org/doc/04-schema.md#provide)\n* [replace](https://getcomposer.org/doc/04-schema.md#replace)\n  (optional, see [merge-replace](#merge-replace) below)\n* [repositories](https://getcomposer.org/doc/04-schema.md#repositories)\n* [require](https://getcomposer.org/doc/04-schema.md#require)\n* [require-dev](https://getcomposer.org/doc/04-schema.md#require-dev)\n  (optional, see [merge-dev](#merge-dev) below)\n* [suggest](https://getcomposer.org/doc/04-schema.md#suggest)\n* [extra](https://getcomposer.org/doc/04-schema.md#extra)\n  (optional, see [merge-extra](#merge-extra) below)\n* [scripts](https://getcomposer.org/doc/04-schema.md#scripts)\n  (optional, see [merge-scripts](#merge-scripts) below)\n\n\n### require\n\nThe `require` setting is identical to [`include`](#include) except when\na pattern fails to match at least one file then it will cause an error.\n\n### recurse\n\nBy default the merge plugin is recursive; if an included file has\na `merge-plugin` section it will also be processed. This functionality can be\ndisabled by adding a `\"recurse\": false` setting.\n\n\n### replace\n\nBy default, Composer's conflict resolution engine is used to determine which\nversion of a package should be installed when multiple files specify the same\npackage. A `\"replace\": true` setting can be provided to change to a \"last\nversion specified wins\" conflict resolution strategy. In this mode, duplicate\npackage declarations found in merged files will overwrite the declarations\nmade by earlier files. Files are loaded in the order specified by the\n`include` setting with globbed files being processed in alphabetical order.\n\n### ignore-duplicates\n\nBy default, Composer's conflict resolution engine is used to determine which\nversion of a package should be installed when multiple files specify the same\npackage. An `\"ignore-duplicates\": true` setting can be provided to change to\na \"first version specified wins\" conflict resolution strategy. In this mode,\nduplicate package declarations found in merged files will be ignored in favor\nof the declarations made by earlier files. Files are loaded in the order\nspecified by the `include` setting with globbed files being processed in\nalphabetical order.\n\nNote: `\"replace\": true` and `\"ignore-duplicates\": true` modes are mutually\nexclusive. If both are set, `\"ignore-duplicates\": true` will be used.\n\n### merge-dev\n\nBy default, `autoload-dev` and `require-dev` sections of included files are\nmerged. A `\"merge-dev\": false` setting will disable this behavior.\n\n\n### merge-extra\n\nA `\"merge-extra\": true` setting enables the merging the contents of the\n`extra` section of included files as well. The normal merge mode for the extra\nsection is to accept the first version of any key found (e.g. a key in the\nmaster config wins over the version found in any imported config). If\n`replace` mode is active ([see above](#replace)) then this behavior changes\nand the last key found will win (e.g. the key in the master config is replaced\nby the key in the imported config). If `\"merge-extra-deep\": true` is specified\nthen, the sections are merged similar to array_merge_recursive() - however\nduplicate string array keys are replaced instead of merged, while numeric\narray keys are merged as usual. The usefulness of merging the extra section\nwill vary depending on the Composer plugins being used and the order in which\nthey are processed by Composer.\n\nNote that `merge-plugin` sections are excluded from the merge process, but are\nalways processed by the plugin unless [recursion](#recurse) is disabled.\n\n### merge-replace\n\nBy default, the `replace` section of included files are merged.\nA `\"merge-replace\": false` setting will disable this behavior.\n\n### merge-scripts\n\nA `\"merge-scripts\": true` setting enables merging the contents of the\n`scripts` section of included files as well. The normal merge mode for the\nscripts section is to accept the first version of any key found (e.g. a key in\nthe master config wins over the version found in any imported config). If\n`replace` mode is active ([see above](#replace)) then this behavior changes\nand the last key found will win (e.g. the key in the master config is replaced\nby the key in the imported config).\n\nNote: [custom commands][] added by merged configuration will work when invoked\nas `composer run-script my-cool-command` but will not be available using the\nnormal `composer my-cool-command` shortcut.\n\n\nRunning tests\n-------------\n\n```\n$ composer install\n$ composer test\n```\n\n\nContributing\n------------\n\nBug, feature requests and other issues should be reported to the [GitHub\nproject]. We accept code and documentation contributions via Pull Requests on\nGitHub as well.\n\n- [PSR-2 Coding Standard][] is used by the project. The included test\n  configuration uses [PHP_CodeSniffer][] to validate the conventions.\n- Tests are encouraged. Our test coverage isn't perfect but we'd like it to\n  get better rather than worse, so please try to include tests with your\n  changes.\n- Keep the documentation up to date. Make sure `README.md` and other\n  relevant documentation is kept up to date with your changes.\n- One pull request per feature. Try to keep your changes focused on solving\n  a single problem. This will make it easier for us to review the change and\n  easier for you to make sure you have updated the necessary tests and\n  documentation.\n\n\nLicense\n-------\n\nComposer Merge plugin is licensed under the MIT license. See the\n[`LICENSE`](LICENSE) file for more details.\n\n\n---\n[Composer]: https://getcomposer.org/\n[MediaWiki]: https://www.mediawiki.org/wiki/MediaWiki\n[GitHub project]: https://github.com/wikimedia/composer-merge-plugin\n[PSR-2 Coding Standard]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md\n[PHP_CodeSniffer]: http://pear.php.net/package/PHP_CodeSniffer\n[Latest Stable Version]: https://img.shields.io/packagist/v/wikimedia/composer-merge-plugin.svg?style=flat\n[License]: https://img.shields.io/packagist/l/wikimedia/composer-merge-plugin.svg?style=flat\n[Build Status]: https://github.com/wikimedia/composer-merge-plugin/actions/workflows/CI.yaml/badge.svg\n[Code Coverage]: https://img.shields.io/scrutinizer/coverage/g/wikimedia/composer-merge-plugin/master.svg?style=flat\n[custom commands]: https://getcomposer.org/doc/articles/scripts.md#writing-custom-commands\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwikimedia%2Fcomposer-merge-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwikimedia%2Fcomposer-merge-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwikimedia%2Fcomposer-merge-plugin/lists"}