php - Composer: Prefer VCS Repository over Packagist -
i'd use adldap/adldap library in php based project. while maintainer of package has not added package packagist, have included composer.json
file. so, normally, i'd add following my composer.json
, , go day.
"repositories": [ { "type": "vcs", "url": "https://github.com/adldap/adldap" }], "require": { /* other packages */ "adldap/adldap":"4.04" },
however, won't work, because adldap/adldap
claimed by different project in packagist, , composer assumes want packagist package. (making things more complicated, packagist package fork of original project, , fork isn't accepting upstream changes).
is there way tell composer prefer version configured vcs repository? or stuck forking package myself, changing name, , pointing composer fork? (or 1 of other forks maintained work around issue?)
the problem package that, "v4.0.4" version branch doesn't contain composer.json
file. means composer can't pick , skip branch.
you use require inline alias working. https://getcomposer.org/doc/articles/aliases.md#require-inline-alias
{ "repositories": [ { "type": "vcs", "url": "https://github.com/adldap/adldap" } ], "require": { "adldap/adldap": "dev-master 4.0.4-dev" } }
that fetch dev-master
version of adldap/adldap
github , alias 4.0.4-dev
.
i don't know if way, maybe hackish, work.
in future: should include composer.json file in next release, can rid of inline alias , require normal version.
the example above uses same repo, different branch aliasing. next example uses different repo, reference branch (called patch). repo/branch used "instead" of original package. "reference branch" means pick branch forked repo , prefix "dev-". after composer install
, should forked repo of adldap/adldap instead of 1 packagist.
{ "repositories": [ { "type": "vcs", "url": "https://github.com/repo-of-the-fork/adldap" } ], "require": { "adldap/adldap": "dev-patch" } }
while might resolve standalone, may not resolve, when other packages rely on specific version of adldap. solve this, can use "inline alias" trick again: dev-patch 4.0.4-dev
.
Comments
Post a Comment