How to use a specific tag/version with composer and a private git repository?

How to require a specific Git tag? Change the version requirement to dev-master, followed by a hash # and the Git tag name, e.g. v0.5.0, like so: “require”: { “vendor/package”: “dev-master#v0.5.0” } How to require a specific Git commit? Change the version requirement to dev-master, followed by a hash # and the Git commit reference, … Read more

How does the “replace” property work with composer?

The Composer documentation gives two basic examples. I’ll try to explain: Lists packages that are replaced by this package. This allows you to fork a package, publish it under a different name with its own version numbers, while packages requiring the original package continue to work with your fork because it replaces the original package. … Read more

Strategy to override a class in a library installed with Composer

In composer.json, under [“autoload”][“psr-4”], add an entry with namespace as the key and path as the value: { “autoload”: { “psr-4”: { “BuggyVendor\\Namespace\\”: “myfixes/BuggyVendor/Namespace” } } } Copy files you want to override under that path (keeping sub-namespace directory structure) and edit them there. They will be picked in preference to the library package’s original … Read more

How to revert back composer update?

How to revert an update? Easy: Restore the composer.lock file from your version control system that was used before you updated. The composer.lock exactly records which software was installed. So it is paramount to commit this file into version control in order to be able to go back to a working version in case of … Read more