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 Repositories

Laravel Repositories Laravel Package

sinemacula/laravel-repositories

Laravel repositories package offering a structured repository pattern layer for cleaner, testable data access. It helps organize queries behind interfaces, keeping your models and controllers lean.

View on GitHub
Deep Wiki
Context7

Provides data repository patterns with criteria-based query filtering for eloquent model manipulation in Laravel.

Frequently asked questions about Laravel Repositories
How do I install sinemacula/laravel-repositories in a Laravel application?
Install it with Composer using composer require sinemacula/laravel-repositories. The package is a standard Composer dependency with no documented external service requirements, so there is nothing else to provision. Check the package's composer.json for its illuminate/support and illuminate/database constraints before committing, then confirm the service provider registration and configuration steps in the README for your Laravel version.
What PHP and Laravel versions does laravel-repositories v3.2.0 support?
The v3.2.0 release adds attribute-based model declaration, which requires PHP 8.0 or newer. Laravel support is defined by the illuminate/* constraints in the package's composer.json, so verify those ranges against your current and next-year Laravel targets rather than assuming coverage. Also confirm PHPUnit and PHPStan compatibility in CI when you upgrade.
How does criteria-based query filtering work in this Laravel repository package?
The package provides query and criteria abstractions on top of Eloquent, so reusable filter conditions live in criteria classes instead of being duplicated across controllers and services. Your repository applies those criteria to build the underlying Eloquent query, keeping models and controllers lean. This is the main reason to choose it over a hand-rolled base repository class if you already have many shared filters.
How do I tell a repository which Eloquent model it manages?
Before v3.2.0 you declared the backing model with a property or by overriding a method on the repository. From v3.2.0 you can instead declare the model with a PHP attribute, which makes the binding declarative and removes boilerplate when you standardise repositories across many modules. Both approaches are documented in the README, and the attribute is purely additive so you can adopt it for new repositories only.
Does the v3.2.0 attribute break existing repositories that declare a $model property?
No. The attribute is an additive, minor-version feature with no breaking changes or deprecations signalled, so existing property-based and method-based repositories keep working as before. What is not spelled out in the release notes is which declaration wins if a single repository uses both, so test that conflict case in a scratch branch before mixing styles. Keeping the two adoption decisions separate avoids surprises.
Is sinemacula/laravel-repositories safe to run in production and under Laravel Octane?
Release-level risk for v3.2.0 is low: one feature, a minor bump, and no breaking changes. The real consideration is that it is a single-maintainer community package, so API stability is a convention rather than a guarantee and security continuity depends on one person. If you run Octane or other long-lived workers, verify whether model resolution from the attribute is cached, since uncached reflection on every request would be a performance concern.
How do I bind repository interfaces to implementations in a Laravel service provider?
Create a contract interface, extend the package's base repository for your implementation, and bind the interface to the concrete class in a service provider so it can be resolved through the container. Because the package supplies the contract and base repository abstractions, the binding step is ordinary Laravel container work. Start with one bounded context such as billing or catalogue rather than wiring repositories across the whole application.
Can I unit test repositories built with this package, and how do I mock them?
Yes. The point of putting queries behind interfaces is that consumers can depend on the contract and you can bind a fake or mock implementation in tests. Test the concrete repository against a real test database when the criteria logic itself is what you are verifying. Confirm PHPUnit and PHPStan compatibility as part of your CI matrix, and ask whether static-analysis stubs or generics annotations exist for the repository and contract pairing.
What are the alternatives to sinemacula/laravel-repositories?
The most common alternative is writing a thin base repository class plus your own interfaces, which gives you full control and no third-party maintenance risk. If criteria-based filtering is the feature you actually need, also evaluate query-filter packages that solve that narrower problem, or keep Eloquent as your domain model and skip repositories entirely. This package fits best where controllers are already thin and business logic lives in services.
Is sinemacula/laravel-repositories actively maintained and is a single maintainer a risk?
It is a community package maintained by one individual, which means continuity depends on that person's availability and API stability is a convention rather than a guarantee. Before adopting, review the release history and cadence, such as the gap between v3.1.0 and v3.2.0, to judge how responsive maintenance has been. Because it is an optional architectural layer rather than a framework dependency, the blast radius is contained if you later reverse the decision.
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo