定制 codebider/service-generator-tool 二次开发

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

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

codebider/service-generator-tool

最新稳定版本:v0.0.1

Composer 安装命令:

composer require codebider/service-generator-tool

包简介

A Laravel package to generate service classes using an Artisan command.

README 文档

README

Laravel Service Generator

Packagist Downloads Packagist Version

Laravel Service Generator

License: MIT

A simple yet powerful Laravel package to generate service classes using an Artisan command.

📦 Installation

You can install the package via Composer:

composer require codebider/service-generator-tool

If you’re using Laravel < 5.5, add the service provider manually in config/app.php:

'providers' => [
    CodeBider\ServiceGenerator\ServiceGeneratorServiceProvider::class,
];

⚙️ Configuration (Optional)

You can publish the config and stub file using:

php artisan vendor:publish --provider="CodeBider\ServiceGenerator\ServiceGeneratorServiceProvider"

This will publish:

  • config/service-generator.php
  • stubs/service.stub

🧪 Usage

Generate a new service class using:

php artisan make:service {name}
php artisan make:service InventoryService

This will create the service class in the configured path named as InventoryService (default: app/Services).

🛠 Configuration Options

File: config/service-generator.php

return [
    'namespace' => 'App\\Services',
    'path' => app_path('Services'),
];

✏️ Custom Stub

By default, the package provides a service.stub file. You can customize the stub by modifying the published file:

/stubs/service.stub

The stub supports two variables:

  • {{ namespace }}
  • {{ class }}

Example stub:

<?php

namespace {{ namespace }};

class {{ class }}
{
    //
}

✅ Testing

composer test

📄 License

This package is open-sourced software licensed under the MIT license.

👤 Author

Developed with ❤️ by Awais Javaid
📦 Package: codebider/service-generator

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request or open an issue.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-22