ferdinalaxewall / service-repository-generator
Laravel Service and Repository Generator Package
1.1.2
2023-09-19 21:50 UTC
This package is auto-updated.
Last update: 2025-01-30 03:36:19 UTC
README
Laravel Service Repository Generator
Laravel Service Repository Generator is a Package for Generating Service and Repository Class based on Model or custom name
Installation Guide
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
Default Service Repository Directory Structure Based
├── app | ├── Services | | ├── Entity | | | ├── EntityService.php | | | ├── EntityServiceImp.php | ├── Repositories | | ├── Entity | | | ├── EntityRepository.php | | | ├── EntityRepositoryImp.php | | └── BaseRepository.php
Usage Guide
Generate Service Repository Class with Interface
Generate Service and Repository Class with construct the Model and Create Base Repository Class
php artisan make:service-repository {model}
Generate Service Only Class with Interface
Generate Service Class
php artisan make:service {service-name}
Generate Repository Only Class with Interface
- 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}
Features
- 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)
Contributors
License
This project is released under the MIT license.