laravel-interaction/interactions
Laravel Interaction lets Eloquent models interact polymorphically—likes, favorites, votes, follows, bookmarks, subscriptions, and more. Attach reusable interaction types to any model, query who interacted and what they interacted with, and build social features with clean, extendable APIs.
Architecture fit
laravel-interaction/interactions is a lightweight polymorphic relationship package: it adds trait-based behavior to Eloquent models so any model can "interact" with any other model (like, bookmark, subscribe, vote, or custom types), backed by a single interactions table and a corresponding Interaction model. It is a domain-adjacent convenience layer, not infrastructure. For a product with social or engagement features (reactions, follows, favorites, saved items), it removes roughly a sprint of bespoke schema, trait, and query-scope work. For products without such features, or where interactions are a first-class domain (feed ranking weights, moderation states, audit trails, event-sourced engagement), the package's abstraction is likely too thin and we would end up extending or forking it — a signal to build in-house instead.
Integration feasibility Low effort. Standard Composer install, publish and run the migration, add the trait to participating models, and optionally configure the interaction type set. No service provider configuration of consequence, no external services, no credentials, no queue or scheduler dependencies. The realistic scope is a few hours of implementation plus test coverage, dominated by deciding which models participate and enforcing uniqueness semantics on the pivot rather than by the package itself.
Technical risk This release (3.5.0) is additive and low-risk. The substantive changes are forward-compatibility widening:
orchestra/testbench constraint update (PR #223)Approximately twenty of the twenty-four listed PRs are Dependabot bumps to GitHub Actions and the license year — CI-only, zero runtime footprint. There are no documented breaking changes, deprecations, or API modifications; on semver grounds 3.5.0 should be a drop-in for 3.4.x. The risk that matters is not this diff but the surrounding context:
@zingimmick). Acceptable for a leaf utility package; not acceptable if it becomes load-bearing infrastructure.Key questions
Stack fit Native fit for a conventional Laravel monolith or modular monolith on Eloquent. It composes cleanly with policies, gates, API resources, and broadcasting — interactions map naturally to events we may want to fire for notifications or feed invalidation. Poor fit for multi-database or sharded setups, for teams using raw query builders or a non-Eloquent data layer, or for architectures where engagement is written through an event bus rather than synchronous model writes.
Migration path
laravel-interaction/interactions to ^3.5 in an isolated PR, with no application code changes.Compatibility Backward compatible with the 3.x line per semver; no deprecations announced. Downstream compatibility is the real variable: PHPUnit 12 support implies a test-suite upgrade path, and PHP 8.5 support implies runtime adoption — each should be gated independently so a failing test suite cannot be mistaken for a package defect. Verify that our PHPStan/Psalm and Rector baselines understand the widened constraints before merging.
Sequencing Dependency bump first (safe, reversible, one-line) → verify green CI on the existing runtime → schema-drift check → platform upgrades (PHP, then Laravel, then PHPUnit) in separate changes → feature adoption only after the package is proven stable in a non-critical path. Do not bundle the platform upgrade with the feature that motivated the package; those are two different risk profiles and should have two different rollback stories.
Maintenance Minimal. No migrations to manage beyond the initial publish, no configuration surface to keep in sync, no runtime services to babysit. The cost is upgrade hygiene rather than operations: expect a steady cadence of releases that are 80–90% bot noise, so triage should be "read the non-Dependabot PRs, skim the rest." Budget roughly one dependency-review cycle per quarter, plus a short verification whenever Laravel, PHP, or PHPUnit has a major release.
Support Upstream is a single active maintainer with responsive turnaround on ecosystem releases — evidenced here by same-cycle support for Laravel 13, PHP 8.5, and PHPUnit 12. That is better than many two-person projects. The trade-off is no vendor SLA and no commercial escalation path: if the maintainer steps away, we own the code. Mitigation is cheap for a package this size — keep the trait surface we depend on thin, avoid forking internals, and be prepared to vendor it.
Scaling
The package itself does not scale; the table does. Interactions are inherently high-write and high-growth: rows ≈ actors × targets × types, which for even moderate traffic reaches tens of millions quickly. Operational prerequisites, all outside the package's control:
(interactionable_type, interactionable_id) and a separate index on the actor column.(actor, interactionable, type) to make the write path idempotent and prevent duplicate rows under retry.COUNT(*) per row on read.If those are not in place, the package will look fine in staging and become a slow query in production.
Failure modes
Ramp-up Very low: an engineer unfamiliar with the package is productive within a day using the published docs and the shipped migration. The real ramp-up cost is reviewer-level: someone must own the decision of which models participate, what the interaction type vocabulary is, and what the uniqueness and retention guarantees are, then encode those as tests. That owner should be named before adoption, not after the first duplicate-count incident.
How can I help you explore Laravel packages today?