I have one GIT-Repo with all my Modules inside. I want to use Composer to include them into my different projects. Is there a way to have them all in one git repo or do I need to create an own GIT-Repo for each Module?
3 Answers
It is a question of how conveniently easy you want to deal with the single modules.
If you are able to introduce a release process that is grabbing a single module from the shared repository, create a ZIP file from it, put that ZIP together with it's needed composer.json
meta data somewhere, host that ZIP via HTTP(S), and then make Packagist (or the local Satis repository you want to use) aware of that release... then you might use one single repository.
In all other cases, one repository per Composer package is the way to go.
Note that you can of course say "maxinet/random-collection-of-modules" as your only package. And at some later time, if you care enough, you could move parts of that module pack out into a single repository, and re-include it in the pack with composer.
The process of splitting a Git repository is described here: Detach (move) subdirectory into separate Git repository
-
My main problem is, that I don't want to have an other Login, which would be required for Satis. I already upload a key for every user to the server. I don't want to have a special htaccess only for satis. Do you have an idea for that? – MaxiNet Mar 25 '14 at 19:41
-
You haven't explained that you already have one login (for what exactly?), so I don't understand why you'd need ANOTHER login (hint: Satis does not require logins - for what is that other login?) And what has uploading keys for users to do with that? Please give more details about your situation - you best update your question with that. – Sven Mar 26 '14 at 22:48
You can use different branches of the same repository.
Then, require them in composer by
composer require vendor/repository-name:dev-branch-A
Prefix the branch name branch-A
with dev-
, if the branch is not tagged with a version.

- 1,975
- 1
- 25
- 43
-
That is smart idea, but won't work if you want to use multiple different packages for the same repository. They would just been override with the chosen branch, which is not what you possibly want :( I've pushed different package names per branch, but that also didn't help? – jszoja Apr 19 '21 at 14:39
I've seen your questions and didn't find an answer. So, I've a bit worked on this and implemented a simple package. I've customized satis to use this. https://github.com/andkirby/satis. So, create your satis.json and run:
$ composer require andkirby/satis --dev
$ vendor/bin/satis build satis.json .
Please read about the requirements by link https://github.com/andkirby/multi-repo-composer.
I hope it could help you!

- 2,847
- 2
- 32
- 42