jason-guru/laravel-make-repository
Laravel package adding Artisan “make:repository” scaffolding for the repository pattern. Quickly generate repository interfaces and implementations, keeping controllers slimmer and data access consistent and testable. Easy to install and customize for your app structure.
make:model, make:migration) and integrates seamlessly with Eloquent, ensuring consistency in code generation workflows.make:repository) with minimal configuration, requiring no changes to existing Laravel structures (e.g., app/Models, app/Repositories).make:repository stubs) and configuration via config/make-repository.php, allowing alignment with team conventions (e.g., naming, interfaces, or traits).spatie/laravel-medialibrary, laravel-scout) that rely on repositories for persistence.Mockery or PHPUnit).RepositoryInterface) that the package must adhere to?laravel-repository-pattern, cube/eloquent-repository) with active development?composer require jason-guru/laravel-make-repository
php artisan vendor:publish --provider="JasonGuru\MakeRepository\MakeRepositoryServiceProvider"
resources/stubs for customization.UserRepository, ProductRepository).User::find() → userRepository->find()).config/make-repository.php to match team conventions (e.g., namespace, stub paths).'namespace' => 'App\Repositories',
'stub' => 'custom-repository.stub',
make: commands.MakeRepositoryServiceProvider) without modifying core Laravel bindings.refreshDatabase()).| Phase | Task | Dependencies |
|---|---|---|
| Pre-Integration | Define repository interfaces/contracts. | DDD strategy docs. |
| Installation | Install package, publish stubs. | Composer access. |
| Pilot | Generate 1–2 repositories, test locally. | Existing Laravel project. |
| Refinement | Customize stubs, update config. | Pilot feedback. |
| Rollout | Replace model logic with repository calls. | Code review approval. |
| Documentation | Update team docs on repository usage patterns. | Rollout completion. |
app/Repositories directory).where clauses in repositories vs. model scopes).DB::enableQueryLog()) or add debug methods to repositories.bind() in AppServiceProvider).README section with troubleshooting steps (e.g., clearing config cache).with(), select()) within repositories.| Failure Scenario | Impact | Mitigation Strategy |
|---|---|---|
| Package abandonment | No updates for Laravel 11+. | Fork the package or switch to alternatives. |
| Repository bloat | Overly complex repositories. | Enforce size limits (e.g., <50 lines). |
| N+1 queries in repositories | Performance degradation. | Use with() or loadMissing() in methods. |
| Autowiring failures | Repository not resolvable. | Bind interfaces in AppServiceProvider. |
| Inconsistent stubs | Team uses different templates. | Centralize stub management (e.g., Git submodule). |
How can I help you explore Laravel packages today?