I have a project with a composer.json
where some libraries are pulled from our GitLab:
"require": {
"my/library": "1.0.0",
"my/library-second": "1.2.1"
}
On production, this works fine — Composer fetches the packages from Git.
However, during development, I need to make changes to these libraries locally without creating a release. I want to use path repositories with symlink to my local folder.
The problems I face:
If I add local
path
repositories directly to the maincomposer.json
, it breaks the production build.Using
replace
ordev-master
leads to conflicts with the fixed versions (1.0.0 / 1.2.1).Ideally, I want a way to have a separate local composer.json or override only on the dev machine, so that:
locally the packages are installed as symlinks,
on production the stable Git versions are used,
the main
composer.json
remains unchanged.
Question:
What is the proper way to structure Composer for this use case?
Is there a standard practice or common pattern to separate local and production Composer configuration, while keeping symlinks for local packages during development?
How do PHP projects usually handle local development with symlinks on packages without touching production composer.json?
COMPOSER
. The Composer website has the whole docs.