I have a project that contains a subproject. They are in separate repositories.
In a production environment the subproject would be a dependency of the main project declared in the composer.json
file.
In my development environment I would like to able to work with both projects at the same time. I don't want to composer update
my subproject everytime I modify it.
At the moment I have my subproject included in a subfolder of the main project which is .gitignore
d, in such a way that it is not seen from the main repository but it is seen by the application. This approach poses a series of problems, like:
compose.json
in development and in productioncomposer.json
of the main projectIs there a way to make composer handle this situation all by itself? Is there some better solution to do this?
I don't think there is a perfect solution. The best you can do is to change the version number of your sub-project to the branch you are working on (such as dev-master
) and run composer update
. You can then work directly in the sub-project code in your vendor
directory. You can even commit and push your code from there. The downside is that you have to be careful when you commit your composer.json
and composer.lock
files because of the manual dev-only changes. Changes to those files don't happen terribly often, so it's not too bad.