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

Hasin Laravel Package

biiiiiigmonster/hasin

biiiiiigmonster/hasin brings recursive "has in" relationship queries to Laravel's Eloquent ORM, letting you fetch ancestors, descendants, and other nested tree data with fluent, hasMany-style syntax instead of raw recursive SQL. Ideal for category trees, comment threads, and org charts.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • biiiiiigmonster/hasin is a focused query-layer package: it provides whereHasIn / orWhereHasIn / whereDoesntHaveIn-style methods that rewrite Eloquent's correlated exists (...) subqueries into where ... in (select ...) form. It is additive to Eloquent, not a replacement for it — no service provider rewiring of the ORM, no persistence or schema changes.
  • Fit is best where we have large parent tables filtered by has/whereHas on a related table and the correlated EXISTS plan is the bottleneck (e.g., list endpoints over millions of rows with a selective relationship). It is a poor fit for code paths where the subquery result set is large or non-selective, where the optimizer already rewrites the EXISTS well, or where we depend on whereHas's ability to pass a closure that adds ordering/limits/aggregates to the inner query — IN semantics do not compose identically.
  • Because it is a developer-facing query helper rather than infrastructure, adoption can be per-query and incremental. That keeps blast radius low but also means value only materializes if teams actually reach for it.

Integration feasibility

  • Composer-installable, single-purpose, no migrations, no config publishing implied, no queue/event/cache surface. Integration cost is essentially: add dependency, adopt methods in targeted query builders, benchmark, add tests.
  • The real work is not installation but validation: each candidate call site needs before/after EXPLAIN on production-shaped data, plus a correctness test proving row parity with the whereHas it replaces. Budget engineer-days per batch of call sites, not per install.
  • v5.1.0 itself is a low-risk pull: it is a minor release whose changes are CI tooling bumps plus Laravel 13.x compatibility. No removals, no renamed methods, no deprecations announced. Nothing in the notes suggests consumer action.

Technical risk

  • Framework-internals coupling (primary risk). The package composes Eloquent relation and query-builder internals to build subqueries; that surface is not covered by Laravel's backward-compatibility promise in the same way as public APIs. The release sequence here is instructive: an automated laravel-shift compatibility PR landed, then the maintainer immediately followed with a fix(): l13 compatibility commit. That strongly implies the automated port was insufficient and real behavior needed patching. Green CI on the maintainer's matrix is not evidence that our query shapes still produce identical SQL.
  • Bus factor. Small, effectively single-maintainer project. A major Laravel release that breaks internals could leave us pinned and waiting. Mitigation is containment: use it behind our own thin abstraction or a small set of repository classes so it is replaceable.
  • Semantic drift. IN (subquery) and EXISTS (subquery) are equivalent for these predicates in standard SQL, but they are not guaranteed to be equivalent in the presence of NULL handling in the correlation, global scopes applied asymmetrically, soft deletes, or polymorphic relations. Silent row-count differences are the failure mode to test for explicitly.
  • Performance is a hypothesis, not a property. Gains are workload-dependent and can invert on low-selectivity relationships or on engines/versions where the planner handles EXISTS as a semi-join. Treat the package as a candidate optimization, not an upgrade.
  • Confidence caveat: this assessment is derived from the release notes and the package's stated purpose. I have not reviewed the v5.1.0 diff, the composer constraints, or the actual SQL emitted. Confirm before committing.

Key questions

  1. What are the exact composer.json constraints in v5.1.0 — minimum PHP and the supported Laravel range? Does adding it force a PHP or framework floor above our current baseline?
  2. Does L13 support mean L10/L11/L12 remain supported in the same branch, or did the floor move? Which of our supported versions are covered by the maintainer's CI matrix?
  3. What exactly did the post-laravel-shift "l13 compatibility" fix change, and does it alter generated SQL for any existing query shape?
  4. Which of our known slow endpoints are whereHas-bound, and what did EXPLAIN show? Do we have evidence the rewrite helps before we adopt?
  5. Do any of our existing whereHas usages pass closures with orderBy/limit/aggregates, which may not translate faithfully?
  6. Who owns the fork/replacement path if the maintainer goes inactive during a framework upgrade?

Integration Approach

Stack fit

  • Native Laravel/PHP, Eloquent-first, no runtime services or extensions. It sits inside the application tier and imposes no new infrastructure, no new deployment artifact, no observability requirement. Compatible with our existing middleware, policies, and global-scope conventions as long as scopes are not selectively applied in a way that changes the inner query's semantics.
  • Works with any database driver that supports IN (subquery) planning; behavior and gains differ by engine (MySQL vs PostgreSQL vs SQLite), so validation must happen against the engine we actually run in production, not the test container.

Migration path

  • No migration in the data sense — this is an adoption, not a cutover. There is no state to backfill and no dual-write window.
  • Recommended pattern: leave every existing whereHas in place; introduce whereHasIn only at call sites where a measured problem exists. This yields a per-endpoint rollback (revert the query builder line) rather than a package-level rollback.
  • Where the same relationship filter appears in many places, wrap it once in a scoped repository/query-object method so adoption is a single edit and the underlying package is swappable.

Compatibility

  • Pin ^5.1.0 and let Composer resolve within the major. Stay on 5.x; do not straddle majors across services.
  • Verify the L13 support does not change our effective Laravel floor. If it does, treat it as a platform decision, not a package decision, and sequence accordingly.
  • Confirm the L13 fix in v5.1.0 produces byte-identical SQL for our existing call sites on our current Laravel version — the fix could plausibly branch on framework version and touch code paths we already execute.

Sequencing

  1. Read the v5.1.0 diff for PRs #65/#66 and record the composer constraints. Gate: no forced PHP/framework bump.
  2. Add the dependency behind a feature-flagged query-object wrapper; no production query changes yet.
  3. Pick two or three known-slow, whereHas-heavy read endpoints. Capture baseline query plans and p95 latency.
  4. Rewrite those call sites, assert row parity in tests, compare plans and latency in staging on production-scale data.
  5. Ship to a small traffic slice; compare error rate and latency. Expand only on measured wins.
  6. Document the wrapper as the sanctioned entry point and note the exit path in the repo README.

Operational Impact

Maintenance

  • Low ongoing cost: one Composer entry, no config, no migrations, no scheduled jobs. The maintenance burden is periodic — each Laravel major upgrade requires verifying generated SQL, not just that CI is green.
  • Recommend a standing note on the service's dependency register: "reaches into Eloquent internals; re-validate on every Laravel major." That is the single line that prevents a surprise during an upgrade crunch.
  • Dependabot noise in the release notes (checkout, fetch-metadata, git-auto-commit-action) is maintainer-CI-only and has no bearing on our runtime; do not let it inflate the perceived change surface in review.

Support

  • No vendor support; community OSS under a single maintainer. Internal support burden is small but non-zero: whichever team owns the wrapper owns the behavior contract.
  • Escalation path is GitHub issues plus, if needed, a local patch. Because the package is small and the surface is narrow, an emergency pinned-fork is a realistic fallback — worth stating explicitly so no one treats it as a blocker.

Scaling

  • Scales with the database, not with application instances: it changes the shape of one query, so the effect shows up as reduced per-query cost and reduced database CPU, not as a new scaling dimension. No new connection-pool, cache, or queue pressure.
  • Gains are most likely on large, selective parent-side filters. At high selectivity the IN list itself becomes a cost, so the benefit curve is not monotonic — expect wins on some endpoints and neutral-or-worse on others, and let measurement decide.

Failure modes

  • Silent semantic divergence — whereHasIn returns a different row set than the whereHas it replaced, typically around soft deletes, polymorphic relations, or NULL correlation. Highest severity, lowest detectability. Mitigated by parity tests on representative data.
  • Framework upgrade breakage — a Laravel major changes internals mid-cycle and the package lags. Detectable if the wrapper has integration tests that run on the upgraded framework in CI; otherwise it surfaces as a runtime exception or, worse, malformed SQL.
  • Performance regression on non-selective relationships — the rewrite is slower than the original plan. Detectable in staging benchmarks; recoverable by reverting the call site.
  • Maintainer abandonment — no runtime failure, but a stuck upgrade eventually forces a framework hold or an internal fork. Track maintainer activity as a quarterly review item.
  • Blast radius is naturally contained — a failure affects the specific query paths that adopted it, not the whole application, provided adoption stays behind the wrapper.

Ramp-up

  • Very low for a competent Laravel engineer: the API mirrors whereHas, so the learning is in knowing when to use it, not how. Half a day of documentation and one worked example should be enough for a mid-level developer.
  • The non-obvious skill is query-plan literacy — reading EXPLAIN and judging selectivity. If the team lacks that, adoption will be cargo-cult and the wins will be unverifiable. Budget for a short pairing session with whoever owns database performance rather than formal training.
  • Onboarding cost is one paragraph in the service README: what the wrapper is for, when not to use it, and the re-validation rule on Laravel majors.
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