0

I'm developing module to call REST API and I want to use an external package via composer. In which composer.json I should put dependency? In composer.json in root directory or composer.json in module directory?

0

If your module has a composer.json, this probably means that you installed it via composer. In that case:

  • you might want to reuse that module elsewhere
  • you have to add the dependency to the module composer.json
  • then run composer update your/module --with-dependencies in the project root

BUT if the module sits in app/code and has a composer.json just to satisfy Magentos package inspection, you will have to add any additional dependencies to the project's composer.json. You might want to add it to the module's file as well for documentation purpose, but if the module has not been installed via composer, it won't have any effect.

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.