Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Love

Laravel Love Laravel Package

cybercog/laravel-love

Laravel Love adds an emotional layer to your Laravel app: make any model reactable in minutes so users can like, vote, or react to content, similar to GitHub reactions, YouTube likes, or Reddit votes. A drop-in Composer package covering all use cases, built for enterprise-ready applications.

View on GitHub
Deep Wiki
Context7

Laravel Love adds an emotional layer to your Laravel application, letting users express how they feel about content — likes, dislikes, claps, or votes. Attach the Reacter and Reactable traits to any Eloquent model and start collecting reactions in minutes, no schema changes required.

  • Make any model reactable with a single trait
  • Ships with Like and Dislike; register custom reaction types
  • Polymorphic reacter ↔ reactable relations
  • Aggregated reaction counters and summaries
  • Eloquent scopes and events for filtering and hooks
Frequently asked questions about Laravel Love
How do I add reactions (like GitHub or Reddit) to a Laravel Eloquent model?
Use the `Reacterable` trait on your model and run `php artisan migrate` to set up the database tables. Then call `$post->reactTo($user, 'love')` to register a reaction. The package auto-generates the necessary migrations and relationships.
Can I use custom reaction types like 'laugh,' 'confused,' or 'heart' instead of just 'like/dislike'?
Yes. Define custom reaction types via the `ReactionType` model or use the `createReactionType` helper. For example, `ReactionType::create(['name' => 'laugh', 'weight' => 1])->save()`. These can be used just like built-in types.
Does Laravel Love support weighted reactions (e.g., 1-5 stars or sentiment scores)?
Absolutely. Assign weights to reaction types (e.g., `thumbs-up` = +1, `meh` = 0, `thumbs-down` = -1) via the `weight` field in `ReactionType`. Use `reactTo($model, 'type', $weight)` to apply custom values, like `$post->reactTo($user, 'love', 3)`.
How do I check if a user has already reacted to a model (e.g., to prevent duplicate likes)?
Use the `hasReactedTo` method: `$user->hasReactedTo($post, 'love')`. This checks the database for existing reactions between the user and the model. You can also fetch all reactions for a user with `$user->reactions()`.
Is Laravel Love compatible with Laravel 13 and PHP 8.5? What about older versions?
The package officially supports Laravel 9–13 and PHP 8.0–8.5. If you're on Laravel <9 or PHP <8.0, use version 7.x of the package. Check the [UPGRADING.md](https://github.com/cybercog/laravel-love/blob/master/UPGRADING.md) guide for migration steps.
How are reaction counts (e.g., '1.2K reactions') aggregated and updated in real-time?
Aggregates are updated asynchronously via the `IncrementReactionAggregatesJob`. For high-traffic apps, monitor queue backlogs. You can also cache counts in Redis or implement custom logic for real-time updates using the `ReactionTotal` model.
Can I use Laravel Love for multi-tenancy (e.g., Laravel Nova or Breeze)?
Yes, but ensure `reactant_id` (the model being reacted to) and `reacter_id` (the user reacting) are scoped per tenant. If using a custom user model, extend the `Reacter` trait and override the `getAuthId` method to return the correct tenant-aware ID.
Does this package include frontend UI components for displaying reactions?
No, Laravel Love focuses on backend logic. You’ll need to build your own UI (e.g., buttons, counters) using Blade or a frontend framework. Example: `{{ $post->reactions()->count() }} likes`. The package provides APIs like `reactions()` to fetch data for your UI.
How do I rate-limit reactions (e.g., 1 reaction per minute per user)?
Laravel Love doesn’t include rate-limiting by default. Use Laravel’s `throttle` middleware or packages like `spatie/rate-limiter` to restrict reactions. Example: Apply middleware to your reaction endpoint to limit calls based on `reacter_id`.
Are there alternatives to Laravel Love for simpler like/dislike systems?
For basic likes/dislikes, consider `spatie/laravel-activitylog` (with custom reactions) or `beberlei/doctrineextensions` (for DDD-style voting). However, Laravel Love stands out for its weighted system, custom reaction types, and enterprise-grade aggregation, making it ideal for complex use cases.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager