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

Eloquent Repository Laravel Package

nilportugues/eloquent-repository

A Laravel package that adds a repository layer for Eloquent models, with reusable query criteria, caching support, and cleaner separation between persistence and application logic.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for persistence plumbing. This package supplies the repository abstraction most Laravel teams end up hand-rolling. The decision it informs is whether to standardize on an existing repository layer or keep writing bespoke interfaces per model. Release 2.2.2 doesn't change that calculus — it's a patch release with no breaking changes — but it does show the abstraction is still being actively filled in, which is a point in favor of buying over building.
  • Read-side contract completeness. The addition of count and exists to ReadRepository matters more than a typical patch note. Until now, the read contract presumably could not answer "how many" or "does any row match" without pulling the full write-side surface or dropping back to raw Eloquent. Those two methods are the load-bearing primitives for pagination counts, dashboard tiles, empty-state rendering, and cheap existence checks. This signals the library now covers the common read paths, not just find/all.
  • Use cases it directly unblocks. Paginated list endpoints that need count without hydrating models; "has any unread notifications / pending invites / open tickets" checks that should be a single exists query rather than a collection load; feature gating and onboarding logic keyed on record existence. exists returning a boolean is also a cheaper, more explicit contract than count() > 0.
  • Roadmap signal for teams already on it. Read-side work landing in a patch release is a positive maintenance indicator — the maintainer is closing contract gaps rather than only shipping fixes. If your roadmap depends on this package's interfaces staying coherent, 2.2.2 is a small but real data point that the abstraction is being tended.
  • Stability fix, low urgency. The divide-by-zero fix is a defensive correctness patch. It shouldn't drive any product decision, but it's worth noting because divide-by-zero in a repository layer usually surfaces in pagination math (per-page / offset arithmetic) or aggregate paths — i.e. exactly the code paths that count supports. Treat it as a "upgrade on your normal cadence" item, not a hotfix.

When to Consider This Package

Consider adopting when:

  • Your codebase has (or is heading toward) more than one persistence concern per domain — Eloquent plus a cache decorator, an external API, or a read replica — and you want a seam to swap them.
  • You want interfaces at the domain boundary so application code depends on ReadRepository/write contracts rather than concrete Eloquent models. The new count/exists methods make that boundary meaningfully usable for read-heavy flows.
  • Your team writes the same interface FooRepository / class EloquentFooRepository pair repeatedly and would rather inherit a maintained one.
  • Testability is a stated goal — repositories are a common mock point, and a shared contract reduces the per-model mock surface.
  • You've audited the package's maintenance cadence and are comfortable with it. Two commits in a patch release is not a strong signal either way; check commit history, issue response time, and Laravel version support before committing.

Look elsewhere (or stay on raw Eloquent) when:

  • Your app is straightforward CRUD and the abstraction would be ceremony around a single Model::query() call site.
  • You lean heavily on Eloquent-specific features — complex with() eager-load graphs, chunkById, cursor pagination, scopes, upsert, raw expressions. Repository layers tend to leak or force escape hatches for these, and a leaky abstraction is worse than none.
  • You need a mature, fully-populated contract today. count and exists arriving only in 2.2.2 suggests the read API has been growing incrementally; audit the write side and any query-object/builder surface for similar gaps before standardizing.
  • Governance requires active multi-maintainer projects or commercial support. Confirm maintainer count and release cadence first.
  • You're mid-migration or under a freeze — a patch release is safe to skip until your next routine dependency bump.

How to Pitch It (Stakeholders)

For executives (30 seconds): We're evaluating a small open-source Laravel package that standardizes how our application talks to the database. The new 2.2.2 release is a low-risk patch — no breaking changes — and it fills in two routine read operations (count and exists) that the library previously lacked, plus a defensive bug fix. Net effect: the abstraction is now complete enough for our common read use cases, and the maintenance signal is positive. No cost, no contract, reversible. Recommendation: trial it on one bounded module, not a codebase-wide mandate.

For engineering leads: 2.2.2 adds count and exists to ReadRepository. That closes the most annoying gap in the read contract — we can now do paginated totals and existence checks against the interface instead of reaching through to Eloquent, which was the main reason our mocks kept leaking. The divide-by-zero fix is defensive and likely touches pagination/aggregate arithmetic; upgrade on normal cadence, no urgency, no migration work. Before we standardize: audit the write-side contract for the same kind of gaps we just saw closed on the read side, confirm the package's Laravel version support against our matrix, and check maintainer responsiveness. Then pilot on one module with a real swap case (e.g. a cached or read-replica implementation) so we can prove the seam pays for itself.

Caveat to carry into the decision: this assessment is based solely on the 2.2.2 release notes, not on source review, benchmarks, or maintenance history. Treat the maturity read as provisional until someone spends an hour in the repository.

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.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib