-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Suggest polyfill packages providing an extension when it is missing. #11669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
For context, the Symfony packages are currently defining a requirement on
The big drawback of this approach is that it wastes both bandwidth, disk space and some time loading the bootstrapping files (there is no function autoloading so this is not lazy) for all projects that do have the extension installed, which is the recommended setup. This can be solved by the My suggestion would allow solving the DX reason even for packages that require |
I am not sure if this really is an issue, but I guess polyfills currently also help users that run Can probably be solved by frameworks and libraries recommending to run |
@glaubinix if you run |
Definitely agree with that and I fully support the feature. I just had a feeling that moving away from adding polyfills by default might result in support requests where people suddenly run into broken deployments. |
Problems I see with this and why I'll close it:
As a consequence, the only way I see this working is allowing polyfills to declare that a particular php version or extension entirely replaces them and makes them unnecessary to install. But we can't have polyfills automatically fill in for ext or php version requirements. There is ongoing discussion on a potential solution to that latter idea in #7557 so closing this here. |
Going to reopen this, cause we can still add the list of polyfills as a suggestion like we already do for other providers. |
When a package requires
ext-mbstring
and you don't have it, the output currently looks like that:Installing the mbstring extension is indeed the best solution in term of performance. However, there is another alternative if you cannot install the extension: installing a polyfill package that provides the API implemented in PHP. For instance,
symfony/polyfill-mbstring
provides it forext-mbstring
.The providers-api-url of Packagist works fine for those extension packages. For instance, the list of packages providing
ext-mbstring
is at https://packagist.org/providers/ext-mbstring.jsonSo it would be great if Composer could load it and display an alternative solution based on installing a polyfill package.
The text was updated successfully, but these errors were encountered: