I am creating a magento 2 module that requires a 3rd party library, but have no idea how do I install it with the module.

This is my module's composer.json file.

    "name": "namespace/name",
    "require": {
        "vandor/library": "^2.2"        
    "type": "magento2-module",
    "autoload": {
        "psr-4": { "Namespace\\Modulename\\": "" },
        "files": [ "registration.php" ]

When I run the command composer install, it installed the library in the module's directory.

I need to install it in the <magento_root>/[lib or vendor (whichever is correct)], please note that I need to upload this extension to the marketplace.



Browse other questions tagged or ask your own question.