In Magento 2, the magento/magento2-base package has the following component_paths section in its composer.json file.

"extra": {
    "component_paths": {
        "trentrichardson/jquery-timepicker-addon": "lib/web/jquery/jquery-ui-timepicker-addon.js",
        "colinmollenhour/cache-backend-redis": "lib/internal/Cm/Cache/Backend/Redis.php",
        "colinmollenhour/credis": "lib/internal/Credis",
        "components/jquery": [
        "blueimp/jquery-file-upload": "lib/web/jquery/fileUploader",
        "components/jqueryui": "lib/web/jquery/jquery-ui.js",
        "twbs/bootstrap": "lib/web/jquery/jquery.tabs.js",
        "tinymce/tinymce": "lib/web/tiny_mce"

What is this used for? It doesn't appear to be a part of stock composer, and a quick text search though Magento's source didn't reveal any obvious uses.

1 Answer 1


It is indeed used as a test that enforces validity of composer.json files and any other conventions in Magento components.

You can find the usage of this section in /dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php::testComponentPathsInRoot(). The full method looks like this :

public function testComponentPathsInRoot()
    if (!isset(self::$rootJson['extra']) || !isset(self::$rootJson['extra']['component_paths'])) {
        $this->markTestSkipped("The root composer.json file doesn't mention any extra component paths information");
        "If there are any component paths specified, then they must be reflected in 'replace' section"
    $flat = $this->getFlatPathsInfo(self::$rootJson['extra']['component_paths']);
    while (list(, list($component, $path)) = each($flat)) {
            self::$root . '/' . $path,
            "Missing or invalid component path: {$component} -> {$path}"
            "The {$component} is specified in 'extra->component_paths', but missing in 'replace' section"
    foreach (array_keys(self::$rootJson['replace']) as $replace) {
        if (!MagentoComponent::matchMagentoComponent($replace)) {
                "The {$replace} is specified in 'replace', but missing in 'extra->component_paths' section"

So this test case looks like it ensures the all extra components which are using by Magento are configured properly in composer.json.

If you find any other usages of this section, please let me know. Thanks for asking this question Alan.

  • That test is testing the replace and component_paths matchup, but why is component_paths there in the first place?
    – Alan Storm
    Apr 18, 2016 at 15:19
  • The test ensures that all packages mentioned in "replace" really exist in Magento code, so if a library is removed, its mentioning is removed from composer.json as well. As composer.json contains information about dependencies, it seems good place for such mapping information as well. It could be in a separate file, but it feels more reliable to keep it in the same place as "replace" list.
    – BuskaMuza
    Apr 19, 2016 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.