Skip to content
Composer installer for Magento modules
PHP Other
  1. PHP 99.8%
  2. Other 0.2%
Branch: master
Clone or download
Pull request Compare This branch is 99 commits ahead, 134 commits behind magento-hackathon:master.
viktym Merge pull request #22 from magento-mpi/MAGETWO-90860
MAGETWO-90860: magento-deploy-ignore doesn't work in composer.json
Latest commit 9fc7b89 Jul 4, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc Update Mapping.md Jun 25, 2014
res [~TASK] added target xml from magento to have a configurable mapping Jan 12, 2013
src/MagentoHackathon/Composer MAGETWO-90860: magento-deploy-ignore doesn't work in composer.json Jun 26, 2018
tests use real installer for global test Jun 7, 2014
.gitattributes Adjust export-ignore list in .gitattributes Oct 31, 2012
.gitignore decide to commit phpcs report Jun 14, 2014
.travis.yml fix allowed failures Mar 31, 2014
CodeSniffer.conf add phpcs as dev dependency to experiment with it Jun 12, 2014
README.md
build.xml [~TASK] Added phpdoc Oct 27, 2012
composer.json MAGETWO-54120: Installation fails because of colinmollenhour/cache-ba… Jun 9, 2016
n98-magerun.yaml add first command for magerun context Jun 5, 2014
phpunit.xml.dist be more exact in path for phpunit Feb 17, 2014
report.full fix some coding style issues Jun 14, 2014
run_phpcs.sh generate a report file on phpcs execution Jun 12, 2014
run_phpcs_experiment.php add phpcs as dev dependency to experiment with it Jun 12, 2014

README.md

Magento Composer Installer

This is a fork of the Magento Composer Installer repo that provides support for Magento 2 components (modules, themes, language packages, libraries and components).

Usage

In the component's composer.json, specify:

  • type, type of Magento 2 component.

  • extra/map, list of files to move and their paths relative to the Magento root directory.

  • extra/chmod, list of permissions that should be set for files.

    Note:

    • extra/map is required only if your component needs to be moved to a location other than <Magento root>/vendor. Otherwise, omit this section.
    • extra/chmod is required only if you need to set specific permissions for files.

Supported Components

The following list explains the use of type in composer.json.

Magento Module

"type": "magento2-module"

Installation location: Default vendor directory or as defined in extra/map

Example:

{
    "name": "magento/module-core",
    "description": "N/A",
    "require": {
        ...
    },
    "type": "magento2-module",
    "extra": {
        "map": [
            [
                "*",
                "Magento/Core"
            ]
        ]
    }
}

Final location is <magento root>/app/code/Magento/Core

Magento Theme

"type": "magento2-theme"

Installation location: app/design

Example:

{
    "name": "magento/theme-frontend-luma",
    "description": "N/A",
    "require": {
        ...
    },
    "type": "magento2-theme",
    "extra": {
        "map": [
            [
                "*",
                "frontend/Magento/luma"
            ]
        ]
    }
}

Final location is <magento_root>/app/design/frontend/Magento/luma

Magento Language Package

"type": "magento2-language"

Installation location: app/i18n

Example:

{
    "name": "magento/language-de_de",
    "description": "German (Germany) language",
    "require": {
        ...
    },
    "type": "magento2-language",
    "extra": {
        "map": [
            [
                "*",
                "Magento/de_DE"
            ]
        ]
    }
}

Final location is <magento_root>/app/i18n/Magento/de_DE

Magento Library

"type": "magento2-library"

Support for libraries located in lib/internal instead of in the vendor directory.

Example:

{
    "name": "magento/framework",
    "description": "N/A",
    "require": {
       ...
    },
    "type": "magento2-library",
    "extra": {
        "map": [
            [
                "*",
                "Magento/Framework"
            ]
        ]
    }
}

Final location is <magento_root>/lib/internal/Magento/Framework

Magento Component

"type": "magento2-component"

Installation location: Magento root directory

Example:

{
    "name": "magento/migration-tool",
    "description": "N/A",
    "require": {
        ...
    },
    "type": "magento2-component",
    "extra": {
        "map": [
            [
                "*",
                "dev/tools/Magento/Tools/Migration"
            ]
        ]
    }
}

Final location is <magento_root>/dev/tools/Magento/Tools/Migration

Autoload

After handling all Magento components, <magento_root>/app/etc/vendor_path.php specifies the path to your vendor directory.

This information allows the Magento application to utilize the Composer autoloader for any libraries installed in the vendor directory. The path to vendor varies between particular installations and depends on the magento_root setting for the Magento Composer installer. That's why it should be generated for each installation.

You must run composer install to install dependencies for a new application or composer update to update dependencies for an existing application.

Deployment Strategy

The Magneto Composer Installer uses the copy deployment strategy. It copies each file or directory from the vendor directory to its designated location based on the extra/map section in the component's composer.json.

There are other deployment strategies that could be used; however, we don't guarantee that any of them will work.

Usage extra/chmod

The following example shows how you can set specific permissions for files.

Example:

{
    "name": "magento/module-sample",
    "description": "N/A",
    "require": {
        ...
    },
    "type": "magento2-module",
    "extra": {
         "chmod": [
            {
                "mask": "0755",
                "path": "bin/magento"
            },
            {
                "mask": "0644",
                "path": "some_dir/file.jpg"
            }
        ]
    }
}

mask is a bit mask for chmod command

path is a path to file relative to the Magento root folder

Notes

  • The extra->magento-root-dir option is no longer supported. It displays only to preseve backward compatibility.
You can’t perform that action at this time.