sbyaute/star-rating-bundle
sbyaute/star-rating-bundle is a Symfony bundle that provides star rating components for displaying and collecting ratings in your applications. Add reusable rating widgets to templates and forms with minimal setup.
Read this first: this is a Symfony bundle, not a Laravel package. There is no service provider, no facade, no config file registered with Laravel, and the templating is Twig. A Laravel developer cannot composer require this and expect it to work inside an App\ codebase without shimming. The realistic relationship a Laravel developer has with sbyaute/star-rating-bundle is as a reference implementation, not as a dependency.
The minimal sequence that actually works:
composer require sbyaute/star-rating-bundle in a Symfony project (not Laravel).config/bundles.php (Symfony Flex may do this automatically).php bin/console assets:install --symlink.Where to look first when you vendor the code:
src/ — the bundle class and any Twig extension/filter (this is the actual API surface; it is small).Resources/ (or templates/ + public/ on newer layouts) — the Twig template and the CSS/JS that render the stars.composer.json — check the symfony/* version constraints; this tells you whether it is even installable on a modern Symfony, and hints at how old the code is.First use case: a read-only display of an average rating on a product/review page. That is the lowest-risk, highest-value thing a star widget does, and it does not depend on the bundle's JS behavior at all — you can reproduce it with a Blade partial in ten minutes.
Because the bundle is not Laravel-native, there are three honest ways to "leverage" it, in descending order of sanity:
1. Port it to a Blade component (recommended). The bundle's real value is the CSS and markup for a star row. Copy the stylesheet into resources/css/, extract the loop that renders filled/half/empty stars, and reimplement it as an anonymous Blade component:
{{-- resources/views/components/star-rating.blade.php --}}
@props(['value' => 0, 'max' => 5])
<div {{ $attributes->merge(['class' => 'star-rating']) }} role="img"
aria-label="{{ number_format($value, 1) }} out of {{ $max }} stars">
@for ($i = 1; $i <= $max; $i++)
<span class="star {{ $value >= $i ? 'full' : ($value >= $i - 0.5 ? 'half' : 'empty') }}"></span>
@endfor
</div>
This gives you Blade ergonomics, no Twig runtime, no Symfony bundle registration, and you control the accessibility markup.
2. Vendor the front-end assets only. If you like the visual treatment, copy just the JS/CSS out of the bundle's Resources/public (or public/) directory into resources/js / resources/css, wire them through Vite, and drive the widget with your own small Alpine or vanilla JS controller. You get the styling without inheriting the PHP integration glue.
3. Run it as a Symfony sidecar. Only makes sense if you actually have a Symfony service in the same product (e.g., a Symfony admin app). Then follow the standard bundle flow above and post ratings to a Laravel API endpoint from the Symfony front end.
Workflow tips regardless of path:
(rating, max, readonly, size) is the shape you want.POST /reviews/{id}/rating), validated between:1,5 (or your max). Do not trust client-side star clicks.StarRatingServiceProvider, no facade, no publishable config, no config/star-rating.php. Any tutorial implying php artisan vendor:publish --tag=star-rating is wrong for this package.@StarRatingBundle/... (Symfony's bundle-relative asset syntax). Laravel's asset() helper has no concept of bundles, so those references break immediately.composer.json require block will tell you the newest Symfony it tolerates. If it caps at Symfony 4/5, it won't install alongside modern dependencies and Composer will fail with a conflict — that failure is your signal to abandon path 1 and just port the CSS.assets:install copies bundle public assets into public/bundles/. There is no vendor:publish equivalent, so copying files into resources/ manually is the correct move and you should commit them.<span> soup need role="img" plus an aria-label with the numeric value, or aria-hidden stars plus a visually-hidden text equivalent. If you go interactive, use real <button> elements with aria-pressed, and make sure keyboard users can set a rating. Check the bundle's markup before trusting it.$value >= $i for full stars and $value >= $i - 0.5 for halves double-counts boundaries; normalize to a 0–100 integer scale, then floor against thresholds, or you'll ship off-by-one stars on exactly 2.5, 3.5, etc.resources/views/components/star-rating.blade.php file with 30 lines and full test coverage via a Blade render assertion beats a dependency you can't patch upstream.config/bundles.php → Twig function undefined; assets not installed → unstyled block of spans; cache not cleared after install → stale Twig extension list.Bottom line for a Laravel developer: read the template and stylesheet, port them to a Blade component, and move on. The package earns its 0-score mostly by not being aimed at your ecosystem and not being maintained — neither of which your product needs to inherit.
How can I help you explore Laravel packages today?