diouma/laravel-add-service 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

diouma/laravel-add-service

Composer 安装命令:

composer require diouma/laravel-add-service

包简介

Générez des services et des interfaces dans Laravel avec la commande artisan

README 文档

README

This package adds a new php artisan make:service {name} {--N|noInterface} command. It will create a service file and its (interface) for saving time while working with Laravel Framework and benefit from the Service Pattern.

Installation

You can install the package via composer:

composer require diouma/laravel-add-service --dev

How does it work?

After installation, the command php artisan make:service {name} {--N|noInterface} will be available.

Create services files

For example, the command php artisan make:service createUser will generate a service file called CreateUserService.php located in app/Services/CreateUser.

It will also generate an interface called CreateUserContract.php located in app/Services/Interfaces.

Create services for models

Adding a --service or -S option is now available when creating a model.

For example, the command php artisan make:model Book --service or php artisan make:model Book -S will generate a model with service too.

The command php artisan make:model Book --all or php artisan make:model Book -a will now generate a model, migration, factory, seeder, policy, controller, form requests and service.

Contracts

Adding a --noInterface or -N option will prevent the commands from implementing any contract and will not create any contract file.

If you never need any contracts. Publish the config file and then turn the with_interface value to false in the config file.

Configuration file

You can publish the config file with:

php artisan vendor:publish --tag="service-add-config"

This is the content of the published config file:

return [
    'with_interface' => true,
];

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-11-04