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 Repository

Laravel Repository Laravel Package

prettus/laravel-repository

A Laravel repository pattern package that decouples your application logic from Eloquent. It provides base repository and interface classes, reusable query criteria, caching support, and service container bindings for cleaner, testable, and more maintainable code.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Laravel Repository
What is prettus/laravel-repository used for?
It provides a repository pattern abstraction over Eloquent, including base repository and interface classes, reusable query criteria, and optional caching. It fits teams that have already committed to a repository plus criteria pattern and want boilerplate plumbing rather than a bespoke implementation. It is a poor fit if your codebase relies on Eloquent scopes, query builders, or DDD-style domain repositories because those patterns overlap and conflict with the package's conventions.
How do I install prettus/laravel-repository?
Install it with a standard Composer require and register the service provider if auto-discovery is not present, which is likely given the package's age. Before committing, verify Composer constraint resolution against your target Laravel and PHP versions. Pin the package version and lock the resolved transitive dependencies so the integration is reproducible.
Which Laravel and PHP versions does prettus/laravel-repository support?
There is no meaningful Laravel version support matrix visible from the package metadata. Low stars and the package's vintage strongly suggest it targets older Laravel majors rather than modern releases. Verify concrete compatibility with a time-boxed spike against your actual target Laravel and PHP versions before relying on it.
Is prettus/laravel-repository still maintained?
The available signals point to likely abandonment: low stars, no evident release cadence, and no clear modern Laravel compatibility. Treat maintenance risk as high and decide upfront whether your team has the appetite to fork if upstream goes quiet. Prefer isolating the package behind project-owned interfaces so replacing or forking it later remains a contained change.
What is the difference between prettus/laravel-repository and prettus/l5-repository?
prettus/l5-repository is described as the better-maintained sibling with roughly ten times the adoption. It may be a substitute, but you should still evaluate its fit against your target Laravel version and architectural needs. Do not assume the sibling solves the same caching, criteria, and compatibility concerns without a spike.
Can I use prettus/laravel-repository with Laravel 10, 11, or 12?
Compatibility with modern Laravel is unproven and should be treated as a risk until demonstrated. Laravel's container, auto-discovery, and Eloquent internals have changed significantly, and a package of this vintage is unlikely to track them. Run a time-boxed spike on one model, one read path, and one cache scenario against your exact target version.
How does caching work in prettus/laravel-repository?
The package offers an optional cacheable repository, which is also its riskiest surface. Cache-key and tag behavior tied to older Laravel cache APIs may silently misbehave on modern drivers. Test cache invalidation explicitly with your target cache driver before using it in production.
How should I test a repository built with prettus/laravel-repository?
Define project-owned repository interfaces and unit-test your application against those interfaces, mocking the repository where appropriate. Add integration tests that assert the SQL generated by criteria composition, because criteria-based queries can obscure what Eloquent actually runs. Avoid letting the package's base classes become your application's dependency surface.
What are the risks of criteria-based query composition?
Criteria objects can obscure the generated SQL, which becomes a real debugging cost in production. Mitigate this by logging generated SQL, keeping criteria small and focused, and covering important read paths with integration tests. If your team already uses Eloquent scopes, introducing criteria creates two competing query paradigms.
What alternatives to prettus/laravel-repository should I consider?
Consider prettus/l5-repository as the better-maintained sibling, a project-owned repository implementation, or staying with Eloquent scopes and query builders. The right choice depends on your actual pain point: testability, query reuse, or caching. Do not introduce this package as a greenfield architectural mandate; pilot it behind project-owned interfaces on one bounded read path first.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console