multi-module projects with composer - maybe we are doing it wrong

196 views
Skip to first unread message

MirkoBeine

unread,
Dec 11, 2013, 3:36:33 AM12/11/13
to compose...@googlegroups.com
Hi @all,

we are very happy composer users. However, in one of our more complex projects, we've been banging our heads against the wall
for quite a while now and can't figure out a working approach.

We have the following project structure:

MainProjectDirectory
 
-Project1
-composer.json
-vendor
-src
-test 
 
-Project2
-composer.json
-vendor
-src
-test
 
-Library
-composer.json
-vendor
-src
-test
 
-.git 

As you can see, both projects and the library reside in the same git repository. The repository is therefore set up on a per-project basis, which is our usual approach.
The "Library" contains stuff that is needed in both projects.

Now, we want Project1 and Project2 to require Library; put simply, composer would just have to copy the directory "Library" to the corresponding vendor subdirectories in  Project1 and Project2.

We know that we could use a separate git repository for the library, but we're not keen to do so as we feel it would hamper the "coding flow" if we'd have to check in our library changes and run composer everytime to see them in the projects.
Furthermore, we do not want to create an extra repository as to us, that simply seems like overkill - we would end up with for or five the time of our current repository count, with most of the repositories beeing of no use to any other but the main project.

We're ok with updating the library and seeing the changes reflected in the projects after running composer update/install once per project (or triggered globally from the main project).

We've done a lot of research on this one and could not find a way to make it work. The repository types provided by composer (git, hg, ...) are not able to simply copy over a directory.
We are sure that this is for a good reason. However, we need to solve our problem and thus hereby turn to you, dear community, begging for help.

If this is not the way composer is meant to be used, can we adjust our project setup to reach a similar structure with composer?
Or have we simply overseen an important detail in composer which would make the given project setup work?

Thank you all in advance!
 
 
 
 

MirkoBeine

unread,
Dec 19, 2013, 3:25:58 PM12/19/13
to compose...@googlegroups.com
We've decided to use some makefiles to build/test/setup/clean/... the whole project; so far, this works very well; we simply copy the Lib project to the desired vendor-dirs and adjust the autoload.php files of the target projects.
Simple solution,
Reply all
Reply to author
Forward
0 new messages