Skip to content

Instantly share code, notes, and snippets.

@abenevaut
Last active July 8, 2025 07:53
Show Gist options
  • Save abenevaut/dde7f2e9a5dd67f65d832479da66ea79 to your computer and use it in GitHub Desktop.
Save abenevaut/dde7f2e9a5dd67f65d832479da66ea79 to your computer and use it in GitHub Desktop.

Using repositories type path in monorepository, allows to require a composer vendor as a symlink from directory path.

When you run composer i this create a symlink in vendor/abenevaut/php-sdk from ../php-sdk. Like this, you are able to dev your main project and the vendor at the same time.

Once you are ready to push the project to production, you don't want the symlink anymore and use the latest content of php-sdk vendor. You can specify COMPOSER_MIRROR_PATH_REPOS=1 to copy directories and files, like normal way to use composer package, from php-sdk.

/!\ You have to deploy from a pipeline who have clone the whole monorepository base code.

COMPOSER_MIRROR_PATH_REPOS=1 composer install --optimize-autoloader --no-interaction --prefer-dist
{
"repositories": [
{
"type": "path",
"url": "../php-sdk"
}
],
"require": {
"php": "^8.3",
"abenevaut/php-sdk": "self.version"
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment