giordanolima/eloquent-repository
A clean repository layer for Laravel Eloquent models. Wrap common query logic behind a simple, testable interface, keep controllers and services lean, and reuse filtering, pagination, and CRUD operations across your app. Swap implementations and mock queries easily in tests.
perPage property: Pagination becomes a declared, configurable default instead of an ad-hoc decision per endpoint. This is a product lever on list-heavy experiences — how much content a user sees per screen, and therefore how deep they scroll vs. filter.orderBy property: A default sort is a product decision (what a user sees first), not a technical detail. Centralizing it means we can ship consistent ordering across surfaces and change ranking behavior in one place when we get feedback.Adopt when:
GlobalScope).Look elsewhere or proceed cautiously when:
GlobalScope without scope-aware keys is a data-leak risk, not just a stale-data risk.Open questions to resolve before adoption: default cache TTL and invalidation semantics, whether GlobalScope is opinionated (tenant-aware) or user-supplied, whether perPage/orderBy are safely overridable per request, and versioning/support posture for a 1.0.0.
Executive summary: This package is a small internal-standard-style building block for our Laravel services. It does not add user-facing features on its own; it reduces the cost and inconsistency of building list, detail, and admin screens, and gives us one place to control pagination defaults, default sort order, data visibility rules, and read caching. Expected benefit is faster delivery of standard CRUD surfaces and lower database load once caching is enabled — not new capability. It is a v1.0.0 with a deliberately thin surface, so the risk is low and reversible, but it is not a platform bet: it should be adopted as a convention, with our own tests around caching and visibility.
For engineering: Standardize on BaseRepository for conventional resources; define cache invalidation and scope-aware keys before enabling the cache driver in production; treat GlobalScope usage as a reviewed decision, since it changes what queries can see. Keep an escape hatch for complex queries rather than expanding the base class.
How can I help you explore Laravel packages today?