• Stars
    star
    890
  • Rank 51,276 (Top 2 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 10 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Merge one or more additional composer.json files at Composer runtime

Latest Stable Version License Build Status Code Coverage

Composer Merge Plugin

Merge multiple composer.json files at Composer runtime.

Composer Merge Plugin is intended to allow easier dependency management for applications which ship a composer.json file and expect some deployments to install additional Composer managed libraries. It does this by allowing the application's top level composer.json file to provide a list of optional additional configuration files. When Composer is run it will parse these files and merge their configuration settings into the base configuration. This combined configuration will then be used when downloading additional libraries and generating the autoloader.

Composer Merge Plugin was created to help with installation of MediaWiki which has core library requirements as well as optional libraries and extensions which may be managed via Composer.

Installation

Composer Merge Plugin 1.4.x (and older) requires Composer 1.x.

Composer Merge Plugin 2.0.x (and newer) is compatible with both Composer 2.x and 1.x.

$ composer require wikimedia/composer-merge-plugin

Upgrading from Composer 1 to 2

If 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.

If you update the incompatible plugin using Composer 2, the plugin will be ignored:

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.

Consequently, Composer will be unaware of the merged dependencies and will remove them requiring you to run composer update again to reinstall merged dependencies.

Usage

{
    "require": {
        "wikimedia/composer-merge-plugin": "dev-master"
    },
    "extra": {
        "merge-plugin": {
            "include": [
                "composer.local.json",
                "extensions/*/composer.json"
            ],
            "require": [
                "submodule/composer.json"
            ],
            "recurse": true,
            "replace": false,
            "ignore-duplicates": false,
            "merge-dev": true,
            "merge-extra": false,
            "merge-extra-deep": false,
            "merge-replace": true,
            "merge-scripts": false
        }
    }
}

Updating sub-levels composer.json files

In 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:

$ composer update

This will instruct Composer to recalculate the file hash for the top-level composer.json thus triggering Composer Merge Plugin to look for the sub-level configuration files and update your dependencies.

Plugin configuration

The plugin reads its configuration from the merge-plugin section of your composer.json's extra section. An include setting is required to tell Composer Merge Plugin which file(s) to merge.

include

The include setting can specify either a single value or an array of values. Each value is treated as a PHP glob() pattern identifying additional composer.json style configuration files to merge into the root package configuration for the current Composer execution.

The following sections of the found configuration files will be merged into the Composer root package configuration as though they were directly included in the top-level composer.json file:

require

The require setting is identical to include except when a pattern fails to match at least one file then it will cause an error.

recurse

By default the merge plugin is recursive; if an included file has a merge-plugin section it will also be processed. This functionality can be disabled by adding a "recurse": false setting.

replace

By default, Composer's conflict resolution engine is used to determine which version of a package should be installed when multiple files specify the same package. A "replace": true setting can be provided to change to a "last version specified wins" conflict resolution strategy. In this mode, duplicate package declarations found in merged files will overwrite the declarations made by earlier files. Files are loaded in the order specified by the include setting with globbed files being processed in alphabetical order.

ignore-duplicates

By default, Composer's conflict resolution engine is used to determine which version of a package should be installed when multiple files specify the same package. An "ignore-duplicates": true setting can be provided to change to a "first version specified wins" conflict resolution strategy. In this mode, duplicate package declarations found in merged files will be ignored in favor of the declarations made by earlier files. Files are loaded in the order specified by the include setting with globbed files being processed in alphabetical order.

Note: "replace": true and "ignore-duplicates": true modes are mutually exclusive. If both are set, "ignore-duplicates": true will be used.

merge-dev

By default, autoload-dev and require-dev sections of included files are merged. A "merge-dev": false setting will disable this behavior.

merge-extra

A "merge-extra": true setting enables the merging the contents of the extra section of included files as well. The normal merge mode for the extra section is to accept the first version of any key found (e.g. a key in the master config wins over the version found in any imported config). If replace mode is active (see above) then this behavior changes and the last key found will win (e.g. the key in the master config is replaced by the key in the imported config). If "merge-extra-deep": true is specified then, the sections are merged similar to array_merge_recursive() - however duplicate string array keys are replaced instead of merged, while numeric array keys are merged as usual. The usefulness of merging the extra section will vary depending on the Composer plugins being used and the order in which they are processed by Composer.

Note that merge-plugin sections are excluded from the merge process, but are always processed by the plugin unless recursion is disabled.

merge-replace

By default, the replace section of included files are merged. A "merge-replace": false setting will disable this behavior.

merge-scripts

A "merge-scripts": true setting enables merging the contents of the scripts section of included files as well. The normal merge mode for the scripts section is to accept the first version of any key found (e.g. a key in the master config wins over the version found in any imported config). If replace mode is active (see above) then this behavior changes and the last key found will win (e.g. the key in the master config is replaced by the key in the imported config).

Note: custom commands added by merged configuration will work when invoked as composer run-script my-cool-command but will not be available using the normal composer my-cool-command shortcut.

Running tests

$ composer install
$ composer test

Contributing

Bug, feature requests and other issues should be reported to the GitHub project. We accept code and documentation contributions via Pull Requests on GitHub as well.

  • PSR-2 Coding Standard is used by the project. The included test configuration uses PHP_CodeSniffer to validate the conventions.
  • Tests are encouraged. Our test coverage isn't perfect but we'd like it to get better rather than worse, so please try to include tests with your changes.
  • Keep the documentation up to date. Make sure README.md and other relevant documentation is kept up to date with your changes.
  • One pull request per feature. Try to keep your changes focused on solving a single problem. This will make it easier for us to review the change and easier for you to make sure you have updated the necessary tests and documentation.

License

Composer Merge plugin is licensed under the MIT license. See the LICENSE file for more details.


More Repositories

1

mediawiki

🌻 The collaborative editing software that runs Wikipedia. Mirror from https://gerrit.wikimedia.org/g/mediawiki/core. See https://mediawiki.org/wiki/Developer_access for contributing.
PHP
3,606
star
2

wikipedia-ios

📱The official Wikipedia iOS app.
Swift
3,059
star
3

apps-android-wikipedia

📱The official Wikipedia app for Android!
Kotlin
2,364
star
4

jquery.i18n

🌐 jQuery based internationalization library
JavaScript
666
star
5

pywikibot

A Python library that interfaces with the MediaWiki API. This is a mirror from gerrit.wikimedia.org. Do not submit any patches here. See https://www.mediawiki.org/wiki/Developer_account for contributing.
Python
618
star
6

operations-puppet

Wikimedia Foundation operates some of the largest collaborative projects in the world. This is the Puppet repo for our servers. This repository is a mirror; see https://www.mediawiki.org/wiki/Developer_access for contributing.
Puppet
244
star
7

node-cssjanus

↔️ Convert CSS between left-to-right and right-to-left. Mirror of https://gerrit.wikimedia.org/g/mediawiki/libs/node-cssjanus/. Contribute via https://www.mediawiki.org/wiki/Developer_account.
JavaScript
198
star
8

VisualEditor

✏ Standalone rich HTML5 editor, based on ContentEditable. Mirror from https://gerrit.wikimedia.org/g/VisualEditor/VisualEditor. See https://mediawiki.org/wiki/Developer_access.
JavaScript
181
star
9

wikipedia-iphone

An obsolete version of the Wikipedia iPhone app. Please use the current version:
Objective-C
179
star
10

jquery.ime

jQuery based input methods library
JavaScript
162
star
11

mediawiki-api-demos

Demo apps and code snippets in Python, Javascript and PHP demonstrating how to use various modules of the MediaWiki Action API
JavaScript
156
star
12

html-metadata

MetaData html scraper and parser for Node.js (supports Promises and callback style)
JavaScript
137
star
13

phabricator-extensions-Sprint

Github mirror of "phabricator/extensions/Sprint" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing
JavaScript
137
star
14

wikidata-query-rdf

Github mirror of "wikidata/query/rdf" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing
Java
136
star
15

mediawiki-services-parsoid

This is a mirror from https://gerrit.wikimedia.org/g/mediawiki/services/parsoid/. See https://www.mediawiki.org/wiki/Developer_access for contributing.
PHP
136
star
16

mediawiki-extensions-Wikibase

🌐 The knowledge base software that drives Wikidata.org. Mirror from https://gerrit.wikimedia.org/g/mediawiki/extensions/Wikibase. See https://www.mediawiki.org/wiki/Developer_access for contributing.
PHP
122
star
17

WikimediaUI-Style-Guide

Wikimedia Design Style Guide with user interface focus, authored by Wikimedia Foundation Design team.
HTML
120
star
18

ores

🤖 A hosting service for 'revscoring' models.
Python
111
star
19

restbase

Distributed storage with REST API & dispatcher for backend services.
JavaScript
104
star
20

search-highlighter

Github mirror of "search/highlighter" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing
Java
95
star
21

revscoring

A generic, machine learning-based revision scoring system for MediaWiki
Python
89
star
22

less.php

Less.js ported to PHP.
JavaScript
80
star
23

jquery.uls

Universal Language Selector
JavaScript
78
star
24

operations-mediawiki-config

⚙️ Configuration for Wikimedia Foundation wikis. This is a mirror from https://gerrit.wikimedia.org/g/operations/mediawiki-config/. See https://www.mediawiki.org/wiki/Developer_access for contributing.
HTML
78
star
25

banana-i18n

banana-i18n - Javascript Internationalization library
JavaScript
77
star
26

mediawiki-extensions-VisualEditor

This is a mirror from https://gerrit.wikimedia.org/g/mediawiki/extensions/VisualEditor. See https://www.mediawiki.org/wiki/Developer_access for contributing.
JavaScript
77
star
27

ws-export

A Wikimedia Toolforge tool for exporting ebooks from Wikisources.
PHP
77
star
28

wikidata-query-gui

Github mirror of "wikidata/query/gui" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
JavaScript
72
star
29

mediawiki-vagrant

A virtual MediaWiki development environment, built on Vagrant, VirtualBox, and Puppet. This is a mirror from https://gerrit.wikimedia.org.
Ruby
67
star
30

wikimedia.github.io

HTML
66
star
31

wikipedia-kaios

The official Wikipedia KaiOS app.
JavaScript
63
star
32

limn

A GUI Visualization Toolkit
HTML
62
star
33

analytics-wikistats2

Mirror from https://gerrit.wikimedia.org/g/analytics/wikistats2
JavaScript
60
star
34

mediawiki-extensions-MobileFrontend

This is a mirror from https://gerrit.wikimedia.org. See https://www.mediawiki.org/wiki/Developer_access for contributing.
JavaScript
59
star
35

oojs-ui

OOUI is a modern JavaScript UI library with strong cross-browser support. It is the standard library for MediaWiki and Wikipedia. This is a mirror from https://gerrit.wikimedia.org. Main website:
JavaScript
56
star
36

operations-software-varnish-varnishkafka

Varnish log collector with Apache Kafka integration. This is a mirror from https://gerrit.wikimedia.org/g/operations/software/varnish/varnishkafka. See https://www.mediawiki.org/wiki/Developer_access for contributing.
C
55
star
37

IPSet

PHP library to match IPs against CIDR specs. This is a mirror from https://gerrit.wikimedia.org/g/IPSet/. See https://www.mediawiki.org/wiki/Developer_access for contributing.
PHP
53
star
38

wikipedia-preview

JavaScript
51
star
39

mediawiki-php-excimer

Mirror from https://gerrit.wikimedia.org/g/mediawiki/php/excimer. See https://www.mediawiki.org/wiki/Developer_access for contributing.
C
50
star
40

search-extra

Github mirror of "search/extra" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing
Java
48
star
41

articlequality

Github mirror - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
Python
47
star
42

WhoWroteThat

A Wikipedia gadget to a browser extension to display article contribution information. Powered by WikiWho.
JavaScript
47
star
43

mediawiki-ruby-api

Github mirror of "mediawiki/ruby/api" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing
Ruby
45
star
44

wvui

Wikimedia Vue UI (WVUI) – Wikimedia Foundation's Vue.js shared user-interface components for Wikipedia, MediaWiki, and beyond. Please file tasks for WVUI and Vue.js on Phabricator: https://w.wiki/3khS, https://w.wiki/Xbt. Mirror from https://gerrit.wikimedia.org/r/plugins/gitiles/wvui
45
star
45

mediawiki-containers

[ARCHIVED] See https://www.mediawiki.org/wiki/MediaWiki-Docker
Shell
44
star
46

design-codex

Codex is a toolkit for building user interfaces within the Wikimedia Design System. Codex contains design tokens, Vue 3 components and VitePress documentation site packages. This is a mirror from https://gerrit.wikimedia.org/g/design/codex/
TypeScript
43
star
47

mediawiki-extensions-Scribunto

Github mirror of MediaWiki extension Scribunto - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
Lua
43
star
48

analytics-quarry-web

Github mirror of "analytics/quarry/web" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing
43
star
49

sentencex

A sentence segmentation library with wide language support optimized for speed and utility.
Python
42
star
50

mediawiki-extensions-Popups

GitHub mirror of MediaWiki extension Popups - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing
JavaScript
41
star
51

operations-software-druid_exporter

This is a mirror from https://gerrit.wikimedia.org. See https://www.mediawiki.org/wiki/Developer_access for contributing.
Python
39
star
52

mediawiki-extensions-CirrusSearch

🔍 Mirror of https://gerrit.wikimedia.org/g/mediawiki/extensions/CirrusSearch. See https://www.mediawiki.org/wiki/Developer_access for contributing.
PHP
39
star
53

performance-arc-lamp

🔥 Flame graphs and trace logs for PHP 7 in production.     Mirror from https://gerrit.wikimedia.org/g/performance/arc-lamp. See https://mediawiki.org/wiki/Developer_access for contributing.
Shell
39
star
54

AhoCorasick

A PHP implementation of the Aho-Corasick string search algorithm. Mirror from https://gerrit.wikimedia.org/g/AhoCorasick - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
PHP
37
star
55

labs-tools-intuition

Mirror of https://gerrit.wikimedia.org/g/labs/tools/intuition
PHP
36
star
56

mediawiki-extensions-Translate

🌐Github mirror of MediaWiki extension Translate - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
PHP
35
star
57

operations-puppet-kafka

Mirror of https://gerrit.wikimedia.org/g/operations/puppet/kafka See https://www.mediawiki.org/wiki/Developer_access for contributing
Puppet
35
star
58

WiktionaryMobile

Wiktionary on Mobile!
JavaScript
35
star
59

editquality

Github mirror - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
Python
34
star
60

translatewiki

Github mirror of translatewiki - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
PHP
34
star
61

KafkaSSE

Kafka Consumer -> HTTP SSE
JavaScript
33
star
62

mediawiki-extensions-SyntaxHighlight_GeSHi

This is a mirror from https://gerrit.wikimedia.org. See https://www.mediawiki.org/wiki/Developer_access for contributing.
PHP
33
star
63

mediawiki-tools-codesniffer

Github mirror of MediaWiki tool codesniffer - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
PHP
32
star
64

mediawiki-extensions

GitHub mirror of the mediawiki/extensions repository. Development happens at https://gerrit.wikimedia.org. Please see https://www.mediawiki.org/wiki/Developer_account if you wish to contribute.
Python
31
star
65

mediawiki-skins-Timeless

Github mirror of "mediawiki/skins/Timeless" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing
Less
30
star
66

WikidataQueryServiceR

An R package for the Wikidata Query Service API
R
29
star
67

operations-debs-pybal

Mirror of https://gerrit.wikimedia.org/g/operations/debs/pybal
Python
28
star
68

grunt-stylelint

Stylelint adapter for the Grunt task runner.
JavaScript
28
star
69

ifttt

[OBSOLETE] Replaced by https://gitlab.wikimedia.org/toolforge-repos/ifttt
Python
27
star
70

eslint-config-wikimedia

JavaScript style guide for Wikimedia.
JavaScript
26
star
71

eslint-plugin-no-jquery

Control allowance of certain jQuery functions, and suggest or autofix alternatives.
JavaScript
26
star
72

mediawiki-skins-MinervaNeue

Github mirror of "mediawiki/skins/MinervaNeue" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
PHP
26
star
73

mediawiki-extensions-Echo

🔔 Notifications for MediaWiki. Mirror from https://gerrit.wikimedia.org/g/mediawiki/extensions/Echo. See https://www.mediawiki.org/wiki/Developer_access for contributing.
PHP
25
star
74

wikilabels

A generalized labeling service for MediaWiki
JavaScript
25
star
75

mediawiki-extensions-Cargo

Github mirror of MediaWiki extension Cargo - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing
JavaScript
25
star
76

mediawiki-extensions-AbuseFilter

Github mirror of MediaWiki extension AbuseFilter - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
PHP
25
star
77

integration-zuul-config

⚙️ This is a mirror from https://gerrit.wikimedia.org. See https://www.mediawiki.org/wiki/Developer_access for contributing.
24
star
78

mediawiki-tools-grunt-cssjanus

Mirror of https://gerrit.wikimedia.org/g/mediawiki/tools/grunt-cssjanus. See https://www.mediawiki.org/wiki/Developer_access for contributing.
JavaScript
24
star
79

jsonschema-tools

Tools to dereference and generated versioned JSONSchemas
JavaScript
23
star
80

WikiContrib

A tool for Wikimedia community members to visualize their technical contributions
JavaScript
23
star
81

DeadlinkChecker

Code to determine if a link on the web is dead or alive
PHP
23
star
82

mediawiki-tools-mwdumper

Github mirror of MediaWiki tool mwdumper - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
Java
23
star
83

mediawiki-tools-phan-SecurityCheckPlugin

Mirror of https://gerrit.wikimedia.org/g/mediawiki/tools/phan/SecurityCheckPlugin See https://www.mediawiki.org/wiki/Developer_access for contributing
PHP
23
star
84

cumin

An automation and orchestration framework — Mirror of https://gerrit.wikimedia.org/g/operations/software/cumin. To contribute see: https://wikitech.wikimedia.org/wiki/Cumin#How_to_contribute_to_Cumin
Python
23
star
85

service-runner

Generic nodejs service supervisor
JavaScript
22
star
86

analytics-kafkatee

Github mirror of "analytics/kafkatee" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing
C
22
star
87

mediawiki-extensions-UniversalLanguageSelector

Github mirror of MediaWiki extension UniversalLanguageSelector - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
PHP
21
star
88

fresh

🌱 Fresh environments.     Mirror of https://gerrit.wikimedia.org/g/fresh. See https://www.mediawiki.org/wiki/Developer_access for contributing.
Shell
20
star
89

jquery.webfonts

jQuery based Webfonts library
JavaScript
20
star
90

mediawiki-extensions-Flow

💬 Github mirror of MediaWiki extension Flow - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing
PHP
20
star
91

mediawiki-extensions-Math

Github mirror of MediaWiki extension Math - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
PHP
20
star
92

mediawiki-extensions-MultimediaViewer

Github mirror of MediaWiki extension MultimediaViewer - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing
JavaScript
20
star
93

eventgate

Library and HTTP Service for validating JSONSchema events and producing them (to Kafka or elsewhere)
JavaScript
19
star
94

kraken

Wikimedia analytics data services platform.
Java
19
star
95

WLMMobile

DEPRECATED -- not for production use. Wiki Loves Monuments app for Android.
JavaScript
19
star
96

mediawiki-extensions-WikiEditor

Mirror of https://gerrit.wikimedia.org/g/mediawiki/extensions/WikiEditor
JavaScript
18
star
97

mediawiki-extensions-NavigationTiming

⏱ Github mirror of MediaWiki extension NavigationTiming - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
JavaScript
18
star
98

mediawiki-php-luasandbox

Mirror of https://gerrit.wikimedia.org/g/mediawiki/php/luasandbox See https://www.mediawiki.org/wiki/Developer_access for contributing
C
18
star
99

operations-dns

Mirror of https://gerrit.wikimedia.org/g/operations/dns. See https://www.mediawiki.org/wiki/Developer_access for contributing.
Python
18
star
100

mediawiki-extensions-PageForms

Github mirror of MediaWiki extension PageForms - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
JavaScript
18
star