dannyweeks/laravel-base-repository
A base repository package for Laravel that reduces boilerplate when working with Eloquent models. It provides reusable CRUD methods, query helpers, eager loading, and caching so you can keep controllers and models lean and your data layer consistent.
all, find, create, update, delete, paginate, plus optional criteria/presenter hooks). The decision it informs is whether to take a dependency for commodity scaffolding versus owning that code in-house. Given the size, the answer is usually "use it as a reference implementation, not a runtime dependency."Consider it when:
illuminate/support constraints still resolve.app/Repositories or an internal package and own maintenance, rather than depending on the upstream repo.Look elsewhere when:
spatie/laravel-query-builder or plain Eloquent scopes are better maintained and better supported.To executives: This is a near-zero-cost, MIT-licensed micro-library that gives us a consistent, testable data-access pattern instead of each team inventing its own. The catch is that it hasn't been updated since 2016 and has minimal community adoption, so I do not recommend taking it as a live dependency. I recommend a 1–2 day spike to fork the base class into our own codebase — we get the pattern, the boilerplate savings, and full ownership, with no supply-chain exposure.
To engineering: It's an abstract BaseRepository with the usual CRUD and pagination helpers plus hooks for criteria/presenters. Surface area is tiny and easy to audit. Before adopting upstream, confirm Composer resolves against our Laravel/PHP versions; if it doesn't (likely), copy the class into our repo and adapt. Treat upstream as a design reference, not a dependency.
The ask: One short spike, a forked internal base repository, and a lint/PR convention that repositories extend it. Success looks like fewer raw Eloquent calls in controllers and higher unit-test coverage on domain logic — not "we adopted a package."
How can I help you explore Laravel packages today?