Using forked repo in composer

Notice: This thread is very old.
amik
Member | 118
+
0
-

Use case:
I like a component installed by composer, but I need to improve/bugfix it. So, I fork the repo and improve the component by my requirements. But I need to use it in my app immediatelly, not wait when/if the repo owner merges it.

Is there some smart way to include the forked repo, or do I have to register the forked repo as a new package on packagist and change composer dependency to it? (not speaking about copying the forked library's files directly into my app, which I really don't want to do.)

How do you solve such cases?

Thanks.

enumag
Member | 2118
+
+5
-

It's easy. For example I forked Zenify/DoctrineMigrations to add support for lower PHP versions. I just added this to my composer.json:

	"repositories": [
		{
			"type": "vcs",
			"url": "https://github.com/enumag/DoctrineMigrations.git"
		}
	],

Composer looks into my fork, sees in composer.json that it is in fact Zenify/DoctrineMigrations package and uses it instead of the original one from packagist.

amik
Member | 118
+
0
-

Thanks, it's exactly the smart solution I wanted :)