- How do I install eghamat24/database-repository in Laravel?
- Install it with Composer using composer require eghamat24/database-repository, then create application-specific repository classes that extend the package's BaseRepository. There is no schema, service provider migration, or extra infrastructure required beyond Laravel or Lumen itself, so adoption is usually just the Composer dependency plus your own repository classes. Check the package's composer.json for the exact illuminate/* constraints before installing.
- Which Laravel and PHP versions does eghamat24/database-repository support?
- The package targets Laravel and Lumen, and the technical evaluation positions it for Laravel 8+ applications, but you should confirm exact PHP and illuminate/* constraints in the package's composer.json before installing. Because it is a small single-maintainer package with one recent release, version support for the newest Laravel majors may lag. Run composer why-not or check Packagist metadata if you are on the latest Laravel version.
- Do I need an interface for every repository, or can I just extend the base class?
- The package provides a base repository class and, in typical usage, a matching interface, so you can extend the base class for implementation and bind an application-specific interface for dependency injection. Keeping your own interfaces in your app means the package base class stays an implementation detail rather than a public contract, which makes it far easier to replace or fork later. Avoid one giant repository per model; split by bounded context.
- How does eghamat24/database-repository compare to using Eloquent models directly?
- Extending the base repository wraps common Eloquent operations such as all, find, create, update, delete, and paginate behind reusable methods, so controllers and services do not repeat query logic. Eloquent models remain the underlying persistence layer; the repository just adds a seam for testing and organization. If your team treats Eloquent models as the domain model, the extra layer may add friction with limited payoff.
- Can I still use Eloquent features like where clauses, model scopes, and eager loading with this repository?
- You can still use Eloquent features, but whether it feels natural depends on the escape hatches the base class exposes, such as access to the underlying query builder or model. Without a deliberate pass-through, complex query composition, global scopes, custom casts, and N+1 tuning can become awkward. Verify the available methods before committing, and avoid bypassing the repository in ways that leak persistence concerns into services.
- Does the package support pagination, soft deletes, and database transactions?
- The package covers common operations including pagination and standard CRUD, but soft delete and transaction behavior depend on how your repositories call through to Eloquent. Because soft deletes and transactions are Eloquent features, they generally work if your repository methods use the model or query builder directly. Confirm support in the source for your version rather than assuming a documented guarantee.
- Is eghamat24/database-repository actively maintained and safe to use in production?
- Treat it as a long-tail utility dependency: roughly 19 stars, a single maintainer, and one recent release in March 2025 mean a low bus factor, no commercial support, and no published SLA. The code surface is small enough to fork, but a fork becomes an internal maintenance obligation. For a data-access layer, many teams will prefer to internalize the pattern or pin the dependency and monitor Laravel compatibility.
- Can I use eghamat24/database-repository with Lumen?
- Yes, the package is described as supporting both Laravel and Lumen, and its footprint is small enough to work in a Lumen application without framework-specific infrastructure. Lumen's narrower feature set can affect things like service provider registration and configuration, so test the integration in your Lumen version. Check whether the current release's constraints still match the Lumen version you run.
- How do I test repositories built with this package?
- Repositories built on the base class are ordinary PHP classes, so you can unit test them with mocked interfaces or integration test them against Laravel's testing database helpers. The main testability benefit is that services can depend on a repository interface instead of a concrete model, making fakes and stubs simpler. Confirm the package's own test coverage and CI before relying on it; the evaluation notes that test coverage and static analysis should be verified.
- What are the alternatives to eghamat24/database-repository for the Laravel repository pattern?
- Alternatives include writing a small in-house base repository, using established Laravel repository packages, or adopting a criteria or specification library for more complex query composition. If you only need a few shared query methods, a 200-line internal base class may be cheaper than an external dependency in your data-access layer. Evaluate alternatives on Laravel version support, escape hatches, and maintenance activity.