I'm trying to find a proper way to force composer to symlink local package.
I know there is a question How to force Composer to download a local package? but it does not answers my questions. I need to make sure it works as expected because I'm going to use this in CI workflow.
Having project's composer.json like:
{
"name": "Some project",
"type": "project",
"minimum-stability": "dev",
"prefer-stable": true,
"repositories": [{
"type": "path",
"url": "packages/*/*"
}]
}
And package's composer.json (packages/sample/package):
{
"name": "Sample package",
"version": "1.0.0"
}
Let's assume that:
sample/package:1.0.0is published in packagist (commitaaaaaa) - with unmodifiedcomposer.jsonsample/packagelocally is checked out on commitbbbbbb- I can't modify
versionofsample/packagelocally
Command 1:
$ composer require sample/package
Package is fetched from packagist (version 1.0.0, commit aaaaaa).
Command 2:
$ composer require sample/package:@dev
Package is symlinked from local version to vendor directory (version 1.0.0, commit bbbbbb, symlinked).
Questions are:
- Why Command 1 downloads package from packagist despite
minimum-stabilityoption? Version constraint@devlets you enforce different stability but it already down todevwith project config. - Will Command 2 create symlink to local package in every case?
- Is there a better way than Command 2 to make sure local package gets symlinked?