Locally reuse package files for independent Composer projects
16:05 01 Jan 2026

Can I develop independent Composer projects that share dependencies (same package+version) without having multiple copies of each reused dependency on my computer? That's the concrete question. But I'm a novice at package managers (though I know PHP fairly well), so in case I asked the wrong question, the abstract question/real scenario that prompted it is below.

Disambiguation

Very similar questions have been asked and answered a number of times. Here's what I'm not asking:

What problem would it solve?

I prefer to use cloud storage, version control, and package managers simultaneously. Git and package managers of course coordinate well. I've been using git and OneDrive together for a while, and while the coordination isn't perfect, it's worked. I regularly perform wide-ranging refactors by hand, so I often have a large number of uncommitted modifications for a while as I find and test the best refactoring strategy. OneDrive backs up the current state, git tracks the history, and GitHub adds redundancy and coordination to the history. Because I usually only change one file at a time, OneDrive was handling the sync burden acceptably before I added Composer. Now it chokes when I add/change a package. That makes sense, since many packages add large numbers of files, and each file requires its own sync record. But of course I don't actually need those package-managed files synced.

I can imagine a way to have it all, where each project is a normal Composer project, but my local Composer installs package versions to a global location and puts pointers in the project to the versions of packages actually in use. Then my cloud storage would sync my current working files and symlinks but none of the package-managed files behind the symlinks, other devs could still clone from GitHub without cloning my symlinks, and local storage could be efficient across packages. But managing symlinks and versions by hand sounds tedious and error-prone.

composer-php package-managers file-management cloud-storage