diff --git a/src/Composer/Repository/RepositoryManager.php b/src/Composer/Repository/RepositoryManager.php index 05dcc1b4a..649c66cd9 100644 --- a/src/Composer/Repository/RepositoryManager.php +++ b/src/Composer/Repository/RepositoryManager.php @@ -89,6 +89,18 @@ class RepositoryManager $this->repositories[] = $repository; } + /** + * Adds a repository to the beginning of the chain + * + * This is useful when injecting additional repositories that should trump Packagist, e.g. from a plugin. + * + * @param RepositoryInterface $repository repository instance + */ + public function prependRepository(RepositoryInterface $repository) + { + array_unshift($this->repositories, $repository); + } + /** * Returns a new repository for a specific installation type. *