- How do I add reactions to an existing Eloquent model in Laravel?
- Use the `love:setup-reactable` Artisan command to add the `Reactable` trait to your model. This generates the necessary methods like `reactTo()`, `unreactTo()`, and `hasReactedTo()`. No manual migration or code changes are needed beyond running the command.
- Can I create custom reaction types like 'Haha' or 'Confused' instead of just Like/Dislike?
- Yes, the package supports fully customizable reaction types. Define them in the `love_reaction_types` table or via migrations, and users can react with any emotion you configure. Weighted scoring (e.g., 1–5 stars) is also supported for nuanced metrics.
- Does cybercog/laravel-love work with Laravel 11 or 13? What about PHP 8.2+?
- The package officially supports Laravel 9–13 and PHP 8.0–8.5, including Laravel 11 and 13. The latest release (April 2026) ensures compatibility with modern Laravel LTS versions. PHP 8.2+ is fully supported as long as it aligns with your Laravel version’s requirements.
- How does the package handle high traffic or millions of reactions per day?
- Reactions are processed asynchronously via queued jobs (`IncrementReactionAggregatesJob`, `DecrementReactionAggregatesJob`), reducing database load. Pre-computed totals are stored in `love_reactant_reaction_totals` and updated via the `love:recount` cron job. For scaling, ensure your queue system (Redis, database, etc.) is sized appropriately.
- Is there a way to validate or restrict reaction rates (e.g., prevent spam or enforce limits)?
- Yes, the package throws `RateOutOfRange` exceptions for invalid rates, which you can catch and handle in your application logic (e.g., API error responses). For spam prevention, integrate rate-limiting middleware or use Laravel’s built-in throttling features alongside the package’s methods.
- Can I use this package for Reddit-style upvotes/downvotes with weighted scores?
- Absolutely. The weighted reaction system allows you to assign decimal values to reactions (e.g., +1 for upvote, -1 for downvote). Customize reaction types and rates in the `love_reaction_types` table, and the package will aggregate scores automatically for your use case.
- What frontend libraries or frameworks work with this package for displaying reactions?
- The package is frontend-agnostic and provides Eloquent methods for backend logic. You can integrate it with any frontend framework (React, Vue, Alpine.js) or even vanilla JavaScript. Example: Use `hasReactedTo()` to check user reactions and `reactTo()` to submit new reactions via API calls.
- How do I upgrade from an older version (e.g., v7 to v8) without data loss?
- Run the `love:upgrade-v7-to-v8` Artisan command (or equivalent for your version) in a staging environment first. The package includes migration scripts to handle schema changes. Always back up your database before upgrading and test thoroughly to ensure compatibility.
- Are there any alternatives to cybercog/laravel-love for Laravel reactions?
- Alternatives include `spatie/laravel-activitylog` (for activity tracking) or `beberlei/doctrineextensions` (for custom DQL functions), but neither offers the same depth of reaction systems. For GitHub/Facebook-style reactions, this package is the most feature-rich and enterprise-ready option for Laravel.
- How do I monitor failed reaction jobs or queue backlogs in production?
- Use Laravel’s queue monitoring tools (e.g., Horizon for Redis) to track job failures. The `IncrementReactionAggregatesJob` and `DecrementReactionAggregatesJob` can be logged via Laravel’s logging system. Set up alerts for queue backlogs or slow recounts using tools like Laravel Telescope or third-party monitoring services.