rohitshakyaa / repository-generator
Laravel package to generate repositories with automatic interface and service provider binding.
Installs: 72
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/rohitshakyaa/repository-generator
Requires
- php: >=8.0
- illuminate/support: ^9.0|^10.0|^11.0
This package is not auto-updated.
Last update: 2025-12-23 17:08:42 UTC
README
This Laravel package adds a make:repository Artisan command that:
- Creates a Repository class and its Interface
- Supports nested paths like
Config.RoleRepository - Automatically binds Interface to Implementation in
RepositoryServiceProvider
Installation
composer require rohitshakyaa/repository-generator
If Laravel doesn't auto-discover it, register manually in config/app.php:
'providers' => [ RohitShakyaa\RepositoryGenerator\RepositoryGeneratorServiceProvider::class, ]
if Laravel >= 11.*, in bootstrap/providers.php
return [ RohitShakyaa\RepositoryGenerator\RepositoryGeneratorServiceProvider::class, ]
Usage
php artisan make:repository UserRepository php artisan make:repository Config.RoleRepository
This will generate:
app/Http/Repositories/Config/RoleRepository.php
app/Http/Repositories/Config/Interfaces/RoleRepositoryInterface.php
And it will auto-bind them in:
app/Providers/RepositoryServiceProvider.php
And to remove repository
php artisan remove:repository UserRepository php artisan remove:repository Config.RoleRepository
This will remove the files and the binding from RepositoryServiceProvider
Publishing Stubs
To customize the stub files, publish them to your app:
php artisan vendor:publish --tag=repository-generator-stubs