These are chat archives for composer/composer

26th
Mar 2018
Karl Viiburg
@kurbar
Mar 26 2018 06:33

Hi. I'm developing a modular application on Composer and have a question regarding dependency inclusions during development.

Currently I have the packages pulled from a VCS.

I have a core module which requires all other modules.

When developing the different modules, I would like to pull in the core module as it implements the user logic.

Though the problem is that when I require-dev the core module, then it tries to automatically install it's dependencies for the modules as well, causing a recursion: e.g help-module > core > help-module...

Does Composer offer any possibilities to pull in a dev dependency without installing the sub-dependencies?

Romain GRELET
@babaorum
Mar 26 2018 06:38
It doesn't feel right having your core module requiring all modules.
It should be suggested packages I think.
Karl Viiburg
@kurbar
Mar 26 2018 06:39
The core is sort of like the base on top of which other modules are built upon
Or should I have a separate app package that pulls together all the modules including core?
Romain GRELET
@babaorum
Mar 26 2018 06:41
Yes i understand. But in your project. You should not say i need the "core" library. You should say, I need the featureXx library (and this library will require the core library to work).
If you want some king of install with all modules without requiring them all in each project you do, it may be done in a different project dedicated to forming it all.
Romain GRELET
@babaorum
Mar 26 2018 06:47
Maybe look at some php framework like symfony, which are splitting into components, and only requiring the needed part in each one.
Karl Viiburg
@kurbar
Mar 26 2018 07:06

I took laravel/framework as a basis for mine. which yeah basically is the same structure that Symfony follows.

I do see that laravel makes use of the replace keyword for replacing individual subpackages, but based on the docs I'm not 100% sure if this is a necessary thing for me as well.

Though yes a difference is that laravel supplies a separate laravel/app package which requires the laravel/framework (core) package.

So maybe I will get away by using replace?

Romain GRELET
@babaorum
Mar 26 2018 08:53
Yes the replace keywork could be usefull. But are you sure it is the right move for you're core package to require you other packages ? Specially all of them ?