zachflower/eloquent-interactions
Add likes, favorites, bookmarks, and other interactions to any Eloquent model in Laravel. A flexible trait-based package for recording user interactions with clean polymorphic relationships, reusable query scopes, and simple APIs.
Architecture fit
zachflower/eloquent-interactions is a small, single-purpose Eloquent extension: it adds a polymorphic interaction record (interactor → interactable) plus model traits so any two models can be linked (e.g., user likes/favorites/bookmarks a post). It is a data-layer concern, so it slots into a Laravel app's domain layer without touching HTTP, queue, or presentation code.Integration feasibility
composer require zachflower/eloquent-interactions:^1.0, publish config/migrations, run migrate, add the provided trait(s) to the interacting model and the interacted-with models.Technical risk
Key questions
illuminate/* and PHP constraints in composer.json for v1.0.0, and is ^1.0 open to a Laravel 11 release without a further major bump?Stack fit
users table as the interactor and any Eloquent model as the interactable; no assumptions about auth scaffolding beyond a model reference.Migration path
^0.2.0 as the fallback, branch, bump to ^1.0, and diff the published migration/config after vendor:publish. If the schema is unchanged, this is a no-op deploy. If it is not, write a forward migration rather than editing the published one.Compatibility
morphs index lengths and case sensitivity of the interaction type column.interactions, likes, or favorites table names and with packages that also register a Interaction model.Sequencing
Maintenance
^1.0 rather than dev-main; add it to the dependency review list alongside other single-maintainer packages.Support
Scaling
Failure modes
firstOrCreate.Ramp-up
How can I help you explore Laravel packages today?