Link local packages for development by modifying composer.json and composer.lock.
Requires PHP 8.2+ and Composer 2.6+
Install globally so it's available in all your projects:
composer global require shipfastlabs/linkOr install per-project:
composer require shipfastlabs/link --devcomposer link ../packages/my-packageThis will:
- Add a
pathrepository entry to yourcomposer.json - Update the
requireconstraint to*so Composer resolves from the local path - Run
composer updateto updatecomposer.lockand symlink the package
composer link ../packages/*Only link packages that are already in your composer.lock:
composer link ../packages/* --only-installedcomposer linkedcomposer unlink ../packages/my-packageThis restores the original version constraint in composer.json and runs composer update to install the released version from Packagist.
composer unlink-allUnlike composer-link which works in-memory, this plugin modifies your composer.json and composer.lock files directly:
composer linkadds apathrepository tocomposer.jsonand runscomposer updatecomposer unlinkremoves the path repository, restores the original constraint, and runscomposer update- Original version constraints are tracked in
vendor/composer-link.jsonso they can be restored on unlink - Both
requireandrequire-devpackages are supported
composer lint # Format code with Pint
composer refactor # Run Rector refactors
composer test:types # Static analysis with PHPStan
composer test:unit # Unit tests with Pest
composer test # Run the entire test suiteLink is open-sourced software licensed under the MIT license.
