4 ms·
with its linking strategy, pnpm allows for multiple versions of the same package. I wish there was something like that in PHP's Composer, where I have repeated
by sam_goody 5y ago
with its linking strategy, pnpm allows for multiple versions of the same package.
I wish there was something like that in PHP's Composer, where I have repeatedly hit situations where different packages have a dependency that was pinned to a different version (such as one package using Guzzle 6 and another Guzzle 7), and therefore my composer.json was un-buildable.
(I have less experience with NPM so I don't know if they have a different solution for this.)
- tored 5y agoProblem is that it can’t be done in PHP without on-the-fly rewriting of source files. In JavaScript the caller decide how a module should be used by importing it to symbol, thus different versions of the same library can exist simultaneously. In PHP it is the callee that decides how to be imported because of namespaces. One and only one class with that exact name and namespace can exist at a given time, thus different versions of the same library can’t be loaded simultaneously. That is why modules are far superior over namespaces.