0

The issue is there's no information about this topic in the Magento 2 documentation or anywhere else, so what's a Magento 2 library and what's its main difference compared with a Magento 2 module?

The only thing the Magento 2 documentation says about Magento 2 libraries is that they are installed under the folder /lib instead of /app/code.

What I have learned by looking at the code in some vendor modules is that Magento 2 libraries use the type ComponentRegistrar::LIBRARY in their registration.php and that there's no di.xml in them but you can still use their classes in the di.xml of other modules. See for example Magento\Framework\MessageQueue which appears in /app/etc/di.xml. Also, since they are not modules, there's no module.xml in them.

But that's all. I'm looking for some insight as for when I should use a library instead of a module.

1 Answer 1

0

From reading the DevDocs, in my understanding, under /lib should go any library that you can not load through composer.

"There are some required libraries that Composer does not load. These reside in lib/..."

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.