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 Like Laravel Package

zing/laravel-like

zing/laravel-like is a lightweight Laravel package for adding like and unlike behavior to Eloquent models. Use traits and polymorphic relationships to let users like any model, check liked status, and retrieve like counts through a simple, expressive API.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. laravel-interaction/interactions occupies a narrow, well-understood slot in a Laravel codebase: a polymorphic persistence layer that attaches typed interactions (like, vote, bookmark, reaction) from an actor model to any subject model, exposed through a trait. That maps cleanly onto standard Laravel idioms — a single migration, a trait on User and content models, Eloquent relationships and scopes for querying. It is a schema-and-ergonomics package, not a domain engine: it does not provide moderation workflows, notifications, rate limiting, anti-abuse, or read-model/feed projection. Teams should evaluate it as "a convention plus a table we would otherwise hand-roll," and budget separately for the product logic on top. The 1.0.0 tag is the meaningful signal here — a pre-1.0 package that has declared API stability, so downstream code can now depend on the surface without expecting churn each minor.

Integration feasibility. Expected effort is low: composer require, publish and run the migration, add the trait, register morph aliases. Realistically a spike in hours and a production integration in one to three days for a single entity type. The friction points are the usual polymorphic ones: existing tables named interactions, non-integer primary keys (UUID/ULID) if the migration hardcodes unsignedBigInteger morph columns, multi-tenant databases where migrations must run per-tenant, and existing like/bookmark tables that need backfilling rather than greenfield creation. All are tractable but should be confirmed against the actual migration file before committing.

Technical risk. Moderate-low, concentrated in three areas rather than in code quality. First, supply-chain and bus-factor: a small-maintainer OSS package with no SLA, so the practical risk is abandonment, not defects; mitigation is that the schema is trivial enough to fork or reimplement in a day. Second, correctness under concurrency — toggle-style interactions need a unique constraint on (interaction type, actor, subject) plus an idempotent write path, otherwise concurrent requests produce duplicate rows and inflated counts. Third, unbounded growth: a row per user per subject per type is one of the fastest-growing tables in a consumer app, and the package almost certainly does not manage retention, partitioning, or counter caches for you.

Key questions. The published release notes for 1.0.0 are a link to the tag with no changelog body, so the following are open and should be resolved from the repository before approval: supported PHP and Laravel version matrix (and whether 1.0.0 drops anything pre-1.0 consumers relied on); supported database drivers and UUID/ULID morph key support; whether a unique index on the interaction triple is shipped; whether aggregate/toggle operations are transactional or use upsert; whether interaction counts are cached or computed per query; test coverage and CI status; multi-tenancy guidance; license and security disclosure policy; whether domain events are emitted on interaction creation/removal; and behaviour when a subject model is deleted (cascade, morph cleanup, or orphaned rows).

Integration Approach

Stack fit. Assumes a conventional Laravel application (service provider auto-discovery, Eloquent models, standard migrations) with no opinion about frontend or API layer. It fits applications that already have a User model and content models with integer or clearly-typed keys. It does not fit cleanly where interactions must be strongly consistent with a separate read model, where the interaction set is fixed and tiny (a single boolean column is cheaper than a table), or where audit/compliance requirements demand immutable, versioned event records rather than mutable toggle rows.

Migration path. Greenfield is straightforward: publish migration, adjust morph key type to match existing PKs, run, add trait. Brownfield (existing likes/favourites tables) requires a mapping exercise: define the legacy-to-package interaction type mapping, add the package alongside the legacy table, backfill historical rows with a chunked job, dual-write for one release cycle, then cut reads over and drop the legacy table. Because the package stores morph types, adopting Relation::enforceMorphMap() before backfill is important — otherwise historical rows carry fully-qualified class names that break on the next model rename.

Compatibility. Verify PHP and Laravel constraints against the application's current matrix, and check for conflicts with any other package that already defines an Interaction model, an interactions table, or a global morph map. Where the application targets multiple Laravel majors, pin the package minor and re-verify on each framework upgrade.

Sequencing. (1) Read the actual migration and trait source, not just the README. (2) Spike on a branch against a staging clone with production-shaped data volume to measure migration lock time. (3) Schema review with the DBA — confirm composite indexes for the two dominant query shapes (count by subject, lookup by actor+subject). (4) Roll out behind a feature flag on one entity type and one interaction type. (5) Expand types incrementally. (6) Only then deprecate legacy tables.

Operational Impact

Maintenance. Low ongoing code maintenance (thin surface, stable API), but it is a dependency that must be re-validated on every Laravel major and every PHP minor bump. Assign an internal owner and a calendar reminder; do not let it become an unowned transitive dependency that surfaces only when a framework upgrade fails.

Support. Community-supported OSS with no vendor SLA. The pragmatic business-continuity position is: treat the package as vendorable. Because the value is a table plus a trait, the exit cost is low, which materially reduces the risk of the no-SLA posture. Document that fallback before adoption so it is a decision, not a scramble.

Scaling. This is the dominant operational concern. Row count scales with actors × subjects × interaction types and will outgrow naive querying first. Plan for composite indexes matched to actual query patterns, denormalised counter columns (like_count on the subject) or a cache layer for any count rendered on a hot page — never withCount on a listing endpoint against a large table. For high-volume deployments, plan retention/archival for stale interaction types and consider partitioning by time or tenant. Write throughput is fine; read amplification from uncached aggregates is what breaks.

Failure modes to instrument. Duplicate interactions from concurrent toggles (assert the unique index exists and alert on constraint violations once it does); count drift between cached counters and source rows (reconciliation job, not a hope); orphaned rows on subject deletion (scheduled cleanup or FK cascade); morph map drift after model refactors (fails silently at read time — cover with a test that exercises each registered alias); migration locking on a large existing table (use online DDL or a shadow table); and unhandled writes during peak traffic if toggling is synchronous in a request path — consider queueing non-critical interaction types.

Ramp-up. Low for engineers — an afternoon to read the source and ship a working integration, and the API is idiomatic enough that Laravel-experienced developers will not need documentation beyond examples. The real ramp-up cost sits with product and trust-and-safety: deciding the interaction taxonomy up front, defining what "unlike" means for downstream counters and notifications, and putting abuse controls (rate limits, per-actor caps, spam detection) around the package, which deliberately provides none. Budget that work explicitly; it will exceed the integration effort.

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.
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route