rez1pro/service-create-command
最新稳定版本:v1.0.0
Composer 安装命令:
composer require rez1pro/service-create-command
包简介
Laravel Service Create Command
README 文档
README
Overview
The Service Pattern is a design pattern that encapsulates business logic into dedicated service classes. This pattern helps maintain separation of concerns and improves code organization by isolating business operations from other layers of the application.
Purpose
- Separate business logic from controllers and models
- Promote code reusability
- Make testing easier by isolating business operations
- Reduce controller complexity
- Improve maintainability
Structure
- Service classes are typically located in the
app/Servicesdirectory. - Each service class is named after the feature it encapsulates, using camelCase notation.
- Services are responsible for handling business logic related to a specific feature or module.
- Services can be used by controllers or other components that need to perform specific operations.
Usage
- Create a new service class in the
app/Servicesdirectory. - Implement the business logic in the service class.
- Use the service class in controllers or other components that need to perform specific operations.
Installation
- Run
composer require rez1pro/service-create-command - Run
php artisan make:service <service-name>to create a new service class.
Register Service Provider
in bootstrap/providers.php
Rez1pro\ServicePattern\ServicePatternServiceProvider::class,
Example
- Run
php artisan make:service SendMessageServiceto create a new service class.
统计信息
- 总下载量: 1.59k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-12-11