jaycode
jaycode

Reputation: 2958

Proper directory structure for composer packages that require other composer packages?

Say for example if I want to create an MVC composer plugin that require Doctrine ORM, I would add doctrine to that plugin's composer.json's "require", right?

Now what if I wish to create a project that require that MVC composer plugin that I just created. Do I need to add doctrine to this project's composer.json's "require"?

In Symfony it does seem I would need to include Doctrine ORM again, but is there anyway possible to make this inclusion recursive somehow?

Thank you!

Edit

It was probably caused by my mistake in directory setup. Let me know if that is the case, here is my setup:

App
 -- my app classes (Controllers, Models, etc.)
library
 -- my
   -- library
     -- Class
     composer.json (in here I have require doctrine)
vendor
composer.json (I do not require doctrine here, 
should doctrine be added to my project when I do composer update in this case?)

Upvotes: 0

Views: 370

Answers (1)

deceze
deceze

Reputation: 522155

Composer will resolve dependencies of dependencies, that's exactly the point. You can simply require a component, and that component can require other components etc. ad infinitum, and Composer will sort it all out and install all required dependencies.

Upvotes: 1

Related Questions