I created a custom module, this module depends on thirt party module(tecnickcom/tcpdf), I added this library in my custom module composer.json file

"name": "packagename/mymodule",
"description": "N/A",
"require": {
    "php": "~5.5.0|~5.6.0",
    "magento/magento-composer-installer": "*",
"type": "magento2-module",
"version": "2.0.0",
"license": [
"autoload": {
    "files": [
    "psr-4": {
        "Packagename\\Mymodule\\": ""


when i run this composer.json file its create vendor folder in my custom module and download "tecnickcom/tcpdf" library, but it should be in root vendor folder. how can i achieve this.

  • You are running composer update in the wrong place. You need to run it from the root magento directory and not from within your module.
    – Smartie
    Feb 24, 2016 at 9:22
  • i tried this one also but not getting any result Feb 24, 2016 at 9:26
  • Is there a dependency in the main projects composer.json file for your custom module?
    – Smartie
    Feb 24, 2016 at 9:45
  • no but how can we add it in root composer.json Feb 24, 2016 at 9:57

1 Answer 1


You should only run composer install or composer update in the "root project". In your case this is the Magento installation. But since it seems like you did not add your custom module with composer but developing it as part of the root project, its own composer.json has no effect at all.

So, you have to add the requirement on your own. Run this in the Magento root directory:

composer require tecnickcom/tcpdf

Note that if you publish your module and others install it via composer, this step is not necessary anymore.

  • I want to use DOMPDF libs without installed via composer . Let me know best way to setup into my extension. Aug 25, 2017 at 4:52
  • 1
    @HiteshVaghasiya please post a new question for that , but use the search first. I'm pretty sure there's already a question about third party libraries without composer Aug 25, 2017 at 6:54

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.