Reuse existing packages via symlink
ScreamingDev opened this issue · 2 comments
Right now Composer-Bin does resolve every single package namespace and installs its dependencies.
Unfortunately this leads to lots of duplicate classes and even different interfaces when the packages are installed in different versions, which really affects the UX within the IDE.
Yes, this can be solved by making the IDE ignoring some specific directories.
But using symlinks would be nice too.
Suggestion
In my opinion Composer-Bin could prevent duplicates by symlinking in a "special way":
- Package-Namespace A needs C and gets installed (with C in version 2.3.4)
- Package-Namespace B needs C too and is about to be installed
- Composer checks if installing B would work with C 2.3.4
- If yes, then composer reuses this via symlink no matter if a higher version can be installed
Now it is up to the IDE to see the symlink and offer just one "thing" in the auto-completion.
Also it is up to the dev to add something like roave security helper,
so that insecure versions wont be used.
Remaining problem: What if the symlink target gets deleted?
Although in theory it would be nice, I don't think this is going to happen unless this plugin possibilities are ported to Composer natively. At the moment it's a tiny wrapper doing a cd + composer command, your suggestion however requires to temper with the whole install process and requires to decide where the main source comes from.
I'll be closing it for the reasons explained above: I think diving into this feature is likely going to be a tremendous amount of work which, at the very least now, I'm not willing to do.