定制 mattyeend/laravel-model-service 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

mattyeend/laravel-model-service

最新稳定版本:v1.1.3

Composer 安装命令:

composer require mattyeend/laravel-model-service

包简介

Extends Laravel make:model to also create a service class when using -S flag or --service option.

README 文档

README

Extends Laravel's make:model Artisan command to also generate a Service class in app/Services when using the -s (or --service) flag.

Features

  • Works with Laravel 10, 11, and 12
  • Fully PSR-4 compliant
  • Generates service alongside model, migration, and controller
  • Seamlessly integrates with all existing make:model options

Installation

composer require mattyeend/laravel-model-service

Laravel will auto-discover the service provider.

Usage

php artisan make:model Post -mcrS
# -> Creates Post model and PostService
php artisan make:model Post --service
# -> Creates PostService
php artisan make:model Post -a 
# -> Creates Post model, migration, controller, factory, seeder, policy, 
#    and now also Postervice

This will create:

app/
    Models/
        Post.php
    Services/
        PostService.php
    Http/
        Controllers/
            PostController.php
database/
    migrations/
        2025_08_15_000000_create_posts_table.php

Flags

  • -m — Create migration
  • -c — Create controller
  • -r — Resource controller
  • -S/--service — Create service

Customizing the Service Stub

You can publish the stub to modify the generated service file:

php artisan vendor:publish --tag=stubs

This will place stubs/service.stub in your project root. Modify it to fit your coding standards.

License

This package is licensed under the MIT License.

Contributing

Feel free to fork the repository and submit pull requests for improvements or new features!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固