rohitshakyaa/repository-generator
最新稳定版本:v1.0.0
Composer 安装命令:
composer require rohitshakyaa/repository-generator
包简介
Laravel package to generate repositories with automatic interface and service provider binding.
README 文档
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
统计信息
- 总下载量: 82
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-26