getsolaris / laravel-make-service
为Laravel 5+创建服务命令的MVCS模式
v1.1.2
2024-02-28 09:15 UTC
Requires
- php: ^7.1|^8.0
- illuminate/console: ~5.6.34|~5.7.0|~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/support: ~5.6.34|~5.7.0|~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- phpunit/phpunit: ^9.5|^10.0
README
为Laravel 5+创建服务命令的MVCS模式
创建新的服务类和服务接口
安装
composer require getsolaris/laravel-make-service --dev
建议
使用说明
$ php artisan make:service {name : Create a service class} {--i : Optional of create a service interface}
示例
创建服务类
$ php artisan make:service UserService
<?php // app/Http/Services/UserService.php namespace App\Services; /** * Class UserService * @package App\Services */ class UserService { }
可选的服务接口
v1.0.x -> contract
v1.1.x -> interface
$ php artisan make:service UserService --i
<?php // app/Http/Services/Contracts/UserServiceInterface.php namespace App\Services\Interfaces; /** * Interface UserServiceInterface * @package App\Services\Interfaces */ interface UserServiceInterface { }