Composer require local package
To require a local package in Composer, you can use the "path" option in the "require" section of your project's composer.json file. For example:
"require": {
"vendor/package-name": "1.0.0",
"vendor/local-package": "path/to/local/package"
}
Watch a video course
Learn object oriented PHP
You can also use the command-line tool to require a local package, by using the "path" type:
composer require vendor/package-name path/to/local/package
It's also possible to use a symlink, in that case you have to add the symlink path in the "repositories" key of your composer.json
file:
"repositories": [
{
"type": "path",
"url": "path/to/local/package",
"options": {
"symlink": true
}
}
],
Then you can require your local package as usual.
composer require vendor/package-name