- Does alt-three/badger work with Laravel 9, 10, or 11?
- Not out of the box. Badger was last released on 2018-09-29 and the repository is archived; its composer.json pins PHP to the 7.x line and illuminate/support to the 5.x line, so Composer will refuse to resolve it on Laravel 9, 10, or 11. On a modern stack your realistic options are forking the package with relaxed constraints, vendoring the source into your app, or reimplementing the small amount of SVG rendering yourself.
- How do I install alt-three/badger in a Laravel 5 application?
- Require alt-three/badger through Composer in a Laravel 5.x or Lumen project and let the package's service provider register, either through package discovery on 5.5+ or by adding it manually in config/app.php on older skeletons. Because the package targets PHP 7.x with Illuminate 5.x, confirm your composer.lock actually resolves before running composer update. Setup is minimal since there is no database, queue, or event wiring involved.
- What does alt-three/badger actually do and what is the basic usage?
- Badger is a presentation-layer helper that renders SVG badge markup from a label, a value, and colours, in the same visual family as the shields you see on README files. You call the generator from a route or controller and return the SVG response, or embed the rendered markup in a Blade view. It is entirely stateless: no persistence, no queues, and no framework events, which makes it easy to isolate behind an interface.
- Is alt-three/badger still maintained and safe to use in production?
- Treat it as unmaintained. The repository is archived, the last release was 2018-09-29, and it has roughly 50 stars with zero dependents, so there is essentially no community backpressure to detect or fix breakage. Adopting it in production means you own the code: no security response process, no PHP 8 deprecation fixes, and silent failures as service provider and facade conventions drift. The package's high opportunity score reflects a gap in the ecosystem, not the quality or health of this implementation.
- Is SVG badge output from Badger vulnerable to XSS injection?
- Potentially yes. Badge labels and values are interpolated into SVG markup, so any user-supplied or request-derived text is an injection surface unless it is escaped at the label and value boundary. SVG served as image/svg+xml is scriptable in a browser context, which makes this a real XSS vector rather than a theoretical one. Escape aggressively and serve badges with a restrictive Content-Type and Content-Disposition if content is ever dynamic.
- How do I customise badge label, value, colours, and style in Badger?
- The generator takes the pieces you would expect for a shields-style badge: a label, a value, a colour for each side, and a flat or flat-square style. The package does not expose a rich configuration surface beyond those inputs, so anything more elaborate means editing the SVG template or extending the generator. Read the source of the exact version you pin before committing to styling behaviour in a spec.
- Can I use alt-three/badger with Lumen or on PHP 8?
- Badger follows the conventional Laravel 5 package shape, so it fits Laravel 5.x and Lumen on PHP 7.x reasonably well. It will not install on PHP 8.1+ without relaxing the Composer constraints, and even then you should expect deprecation notices, typed property issues, and facade registration changes. Lumen users may also need to enable facades and register the provider manually, since package discovery behaviour differs.
- What are the best alternatives to alt-three/badger for generating badges?
- The cheapest alternatives are static SVGs generated at build time or shields.io's dynamic endpoints, both of which remove the dependency and the SVG injection surface in one move. If you genuinely need badges rendered in-process, a small internal helper class that templates the SVG markup is usually cheaper to own than a fork of an archived package. Badge generation remains a real gap in the Laravel ecosystem, which is why this package keeps surfacing despite being abandoned.
- How do I fork Badger and relax its Composer version constraints?
- Fork the repository into your own namespace, then loosen the php and illuminate/support constraints in composer.json to match your host application's PHP and Laravel versions. Replace the archived provider registration with a current-style service provider and add escaping at the label and value boundary while you are in there. Budget for owning that fork indefinitely, or scope the work explicitly as a short borrow-then-replace exercise.
- How do I test Badger's badge output and does it ship with tests?
- There is no meaningful upstream test suite to inherit, so confidence has to come from tests you write yourself. Cover the rendered SVG string, the escaping of label and value text, the HTTP Content-Type on the response, and how the badge displays across GitHub, GitLab, and IDE markdown previewers, where font metrics and text-width estimation are the usual breakage. Snapshot-testing the SVG output is a pragmatic starting point.