How to link a Composer package for local development

How to link a Composer package for local development

Comprehensive guide on how to link a local composer package for development purposes.

Roman Zipp, May 16th, 2018

1. (optional) Remove remote package

composer remove author/package

2. Add local repository

Add the symlink option if your filesystem supports symlinks.

The url value can be the absolute or relative path to the package

{
    "repositories": [
        {
            "type": "path",
            "url": "/Users/author/Code/folder",
            "options": {
                "symlink": true
            }
        }
    ]
}

3. Require the package again

Be sure, to add the @dev version

composer require author/package @dev