cjmellor/rating
A Laravel package for adding ratings and reviews to your models. Supports polymorphic relationships, multiple rating types, and easy Eloquent integration, letting you attach star ratings or reviews to users, posts, products, and more.
Architecture fit
cjmellor/rating is a small, trait-based Eloquent add-on: it attaches a polymorphic ratings table to any rateable model, exposes rating/aggregation methods, and ships a config plus a service provider. The v2.2.0 change removing Livewire from required dependencies is architecturally significant and positive — it converts the package from "a Livewire widget with a data model attached" into a pure domain concern with an optional presentation layer. That makes it viable for API-first, Inertia/Vue, and Blade-without-Livewire stacks, which was previously awkward.
Integration feasibility
Standard Laravel package mechanics: composer require, publish config and migrations, php artisan migrate, add the trait + interface to target models. Laravel 11 compatibility means the package is now testable against the current framework line (via its Orchestra Testbench matrix). No new configuration keys, migrations, or public API are announced in this release, so integration surface is essentially unchanged from 2.1.x.
Technical risk The Livewire change is a soft breaking change, and it's the only real risk here:
composer update will remove it. Any app rendering the package's star component, or a view referencing its Livewire component alias, will fail at render time or at provider boot.class_exists(Livewire::class) or similar. If it does not, the package boots into a Class not found error in production.Key questions
class_exists()? If yes, this is a non-event for non-Livewire apps.^3.0, or is Livewire still pinned to 2.x via suggest/require-dev? Livewire 3 changed component registration, $rules handling, and the wire: directive set — a v2-era component may not work under Livewire 3.illuminate/* constraints, and the supported Laravel range (10.48+ and 11.x)?(rater_id, rateable_type, rateable_id))?Stack fit Laravel 10 (late 10.x) and 11.x applications on PHP 8.1–8.3. Fits both:
The second case is newly clean as of v2.2.0 and is the more defensible long-term shape — it removes a frontend framework from our transitive dependency graph.
Migration path
livewire/livewire explicitly to the root composer.json in the same PR if we use the component. Do not rely on it arriving transitively ever again.composer update cjmellor/rating --with-dependencies in a branch; diff the lockfile to confirm Livewire is either retained (because we now declare it) or removed (because we don't need it).vendor/ — republish only if new keys exist, and never blindly overwrite config/rating.php.php artisan migrate only if the diff shows new migration files; otherwise skip.php artisan livewire:list or equivalent) if the widget is in use.Compatibility
Validate against an explicit matrix before merge: Laravel 10.48 / 11.x × PHP 8.2 / 8.3 × MySQL 8 / Postgres 15 / SQLite. Include the Livewire axis (absent / v3) since that is the actual variable in this release. Confirm the package's illuminate/* constraints don't force a framework minor bump beyond our pinned version.
Sequencing Do it as one atomic change: package bump + explicit Livewire declaration + test-suite run against rating features, in a single PR. Sequence: dev branch → existing feature tests green → smoke-test star component in a preview environment → staging for one release cycle → production in a normal release train. Do not split the Livewire declaration into a follow-up; that creates a window where main is unbuildable. If we don't use the component, take the bump alone — it's then close to a no-op.
Maintenance
Low ongoing effort: the package is small, MIT-licensed, and effectively forkable in an afternoon if abandoned. The counterweight is bus factor 1 — a single maintainer (@cjmellor). The Dependabot activity in this release shows routine upkeep is automated but does not demonstrate succession planning. Laravel 11 support means we're covered through the current support window; expect to re-evaluate at Laravel 12.
Support Community-only: GitHub issues, no vendor SLA, no paid tier. Acceptable for a non-critical engagement feature; not acceptable as a dependency for anything with contractual uptime language unless we're willing to vendor the source.
Scaling Read-heavy, write-light — ratings are user-generated at low volume relative to page views. Two areas to watch:
AVG() trap. Confirm the package uses eager-loadable aggregation or a cache; if it caches, decide the invalidation contract and the cache store (Laravel 11 changed the default cache driver to database).rateable_type + rateable_id and by rater; verify composite indexes exist on the published migration rather than adding them ad hoc later.Failure modes
Class "Livewire\Livewire" not found at boot or render, for apps that lost the transitive dependency. Highest-probability incident from this release.vendor:publish.Ramp-up Half a day for a mid-level Laravel developer. The learning surface is the trait + interface contract on the rateable model, the config options, and — only if the component is used — customising the published Livewire view. Document the explicit Livewire requirement in our own onboarding notes so the next person doesn't rediscover it from a stack trace.
How can I help you explore Laravel packages today?