Link local packages for development by modifying composer.json and composer.lock

Fund package maintenance!
pushpak1300

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:composer-plugin

pkg:composer/shipfastlabs/link

v1.0.3 2026-02-12 08:04 UTC

This package is auto-updated.

Last update: 2026-02-12 08:05:11 UTC


README

Link

Link

Link local packages for development by modifying composer.json and composer.lock.

Requires PHP 8.2+ and Composer 2.6+

Installation

Install globally so it's available in all your projects:

composer global require shipfastlabs/link

Or install per-project:

composer require shipfastlabs/link --dev

Usage

Link a local package

composer link ../packages/my-package

This will:

  • Add a path repository entry to your composer.json
  • Update the require constraint to * so Composer resolves from the local path
  • Run composer update to update composer.lock and symlink the package

Link multiple packages with wildcards

composer link ../packages/*

Only link packages that are already in your composer.lock:

composer link ../packages/* --only-installed

List linked packages

composer linked

Unlink a package

composer unlink ../packages/my-package

This restores the original version constraint in composer.json and runs composer update to install the released version from Packagist.

Unlink all packages

composer unlink-all

How it works

Unlike composer-link which works in-memory, this plugin modifies your composer.json and composer.lock files directly:

  1. composer link adds a path repository to composer.json and runs composer update
  2. composer unlink removes the path repository, restores the original constraint, and runs composer update
  3. Original version constraints are tracked in vendor/composer-link.json so they can be restored on unlink
  4. Both require and require-dev packages are supported

Development

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 suite

License

Link is open-sourced software licensed under the MIT license.