承接 nordcoders/laravel-service-maker 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

nordcoders/laravel-service-maker

最新稳定版本:v1.0.1

Composer 安装命令:

composer require nordcoders/laravel-service-maker

包简介

Generate services and contracts in Laravel with the artisan command

README 文档

README

Laravel Service Maker

Total Downloads Latest Stable Version License

What does it do?

This package adds a new php artisan make:service {name} {--N|noContract} command. It will create a service file and its contract (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 nordcoders/laravel-service-maker --dev

How does it work?

After installation, the command php artisan make:service {name} {--N|noContract} 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 (contract) called CreateUserContract.php located in app/Services/Contracts.

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 --noContract 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-maker-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.

统计信息

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

GitHub 信息

  • Stars: 26
  • Watchers: 2
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-22