felipedamacenoteodoro / makeservicerepository
Generate service and repository file and interface
v1.0.3
2022-01-09 19:25 UTC
Requires (Dev)
- phpunit/phpunit: ^6.5
This package is auto-updated.
Last update: 2024-12-10 02:13:27 UTC
README
Quickly generate command make for Service and Repository files for projects using Laravel packages.
Install
Via Composer
composer require felipedamacenoteodoro/makeservicerepository --dev
Custom directory
Publish the config file and customize your service and repository folder
php artisan vendor:publish --tag=makeservicerepository-config
Usage
Open the console and enter one of the commands:
- Generate all files for one new Service and Repository interface:
php artisan make:crudsrv {Entity_name}
- Generate only Repository Interface class
php artisan make:repository {Entity_name} --interface
- Generate only Service Interface class
php artisan make:service {Entity_name} --interface
- Generate a Service, You will be asked if you want to create the interface too
php artisan make:service {Entity_name}
- Generate a Repository, You will be asked if you want to create the interface too
php artisan make:repository {Entity_name}
Remember
You need to map the interface bind on your application server provider.
- Exemple:
Add In the boot method of your service provider app/Providers/AppServiceProvider.php
:
- add on boot method
$this->app->bind(YourEntityCreatedServiceInterface::class, YourEntityCreatedService::class); $this->app->bind(YourEntityCreatedRepositoryInterface::class, YourEntityCreatedRepository::class);
Change log
Please see CHANGELOG for more information what has changed recently.