Composer require local package
The way to link to a local, in-development package is to first add in your main project's composer.json
a repository, like this:
"repositories": [
{
"type": "path",
"url": "/full/or/relative/path/to/development/package"
}
]
You also need to either have a version specified in your development package's composer.json
or the way I do it is to require the package using @dev
, like this:
composer require "vendorname/packagename @dev"
It should output:
- Installing vendor/packagename (dev-develop)
Symlinked from /full/or/relative/path/to/development/package
The @dev
in the require command is important, composer uses this to pickup the source code and symlink it to your new package.
It's a stability flag added to the version constraint (see package link).
These allow you to further restrict or expand the stability of a package beyond the scope of the minimum-stability setting.
The minimum-stability flags are:
Available options (in order of stability) are
dev
,alpha
,beta
,RC
, andstable
.
You can use Composer's repositories feature
https://getcomposer.org/doc/05-repositories.md#path
{
"repositories": [
{
"type": "path",
"url": "../../packages/my-package"
}
],
"require": {
"my/package": "*"
}
}
Instead of using the http format, specify a file path on disk.