Laravel Service Repository Generator is a Package for Generating Service and Repository Class based on Model or custom name
composer require ferdinalaxewall/service-repository-generator
Go to config/app.php, then put these code on service providers
'providers' => [
/*
* Package Service Providers...
*/
\Ferdinalaxewall\ServiceRepositoryGenerator\ServiceRepositoryGeneratorProvider::class,
],
Last, for make sure this package installed correctly.
composer dump-autoload && php artisan optimize:clear
├── app
| ├── Services
| | ├── Entity
| | | ├── EntityService.php
| | | ├── EntityServiceImp.php
| ├── Repositories
| | ├── Entity
| | | ├── EntityRepository.php
| | | ├── EntityRepositoryImp.php
| | └── BaseRepository.php
Generate Service and Repository Class with construct the Model and Create Base Repository Class
php artisan make:service-repository {model}
Generate Service Class
php artisan make:service {service-name}
- Generate Repository Class with construct the Model and Create Base Repository Class
php artisan make:repository {repository-name} {--model=}
OR
- Generate Repository Class without construct the Model
php artisan make:repository {repository-name}
- Generate Service and Repository Class with Implement Interface
- Generate Only Service Class with Implement Interface
- Generate Only Repository Class with Implement Interface
- Automaticaly Generate Base Repository Class
- Support Nesting Service, Repository Classpath (e.g. Master/User, Master/User/Employee, etc)
- Automaticaly Generate Model (If the model didn't exists) when Create Repository Class
- Automaticaly Class and Interface Binding (Only File inside Services or Repositories Directory)
This project is released under the MIT license.