Description:
PHP version badge on Packagist returns invalid for some packages. It works normally for others.
Working badges:
- https://packagist.org/packages/filips123/monolog-phpmailer/
- https://packagist.org/packages/symfony/symfony/
Invalid badges:
Hi, thanks for the report.
Hmm, I wonder, is this related to #2190, #1586, #885?
@paulmelnikow So what does this mean? Is it issue with package or shields.io? Is it possible to fix it so it will works with any package?
Yes, I imagine it's possible to fix this so it works on any package. It'll take some investigation to find out what's up. If you're up for digging into it, I'm happy to give you some pointers. If not, I or one of the other maintainers will. 馃榿
This is unrelated to those other issues.
The reason why those badges don't work is because if you call packagist/php-v without specifying a version, we assume dev-master as the version. The packages you've linked there don't expose a dev-master version so calling them without a version fails. If you pass a (valid) version, they will render. For example:
- https://img.shields.io/packagist/php-v/slim/slim/3.11.0.svg
- https://img.shields.io/packagist/php-v/slim/slim/4.x-dev.svg
- https://img.shields.io/packagist/php-v/slim/slim/notaversion.svg
I'm not sure that allowing this to be called with no version and defaulting to dev-master is actually a great assumption for this badge, but changing it now is a non-backwards-compatible change.
I think we can probably make the error message a bit more informative and show the example with a version on the home page to make this a bit less confusing.
If dev-master don't exist, the newest (stable) branch or version should probably be used.