4

According to Magento2 Doc By default, when you install a package, Composer puts it into vendor/<package> directory, such as vendor/magento-module-catalog. However, the Magento framework requires Magento components to be in different locations, such as app/code/Magento/Catalog. The process of copying or moving contents of packages from default to the necessary location is called marshalling.

What is the benefit of copying it into vendor/<package> first and then moving it into something like app/code/Magento/Catalog ?

2 Answers 2

4

It looks like several things changed with some latest changes (October 7th) in the develop branch. I created two examples of installing modules. One that copies files to app/code and another that registers the module where it resides in the vendor directory.

Copy Strategy: https://github.com/mttjohnson/magento2-sample-module-minimal-copy
Registration Strategy: https://github.com/mttjohnson/magento2-sample-module-minimal-register

For development purposes I think utilizing the registration strategy is more useful because the files that are being run by Magento can be directly modified, tested and then committed back to the module repo.

4

There is no benefits (except development simplicity, we can hardcode app/code folder in test, utils, etc), it's legacy requirement from m1 to put modules in app/code folder.

But now, we can put components in vendor folder and use autoloading mechanism to register it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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