承接 codebider/trait-generator-tool 相关项目开发

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

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

codebider/trait-generator-tool

最新稳定版本:v0.0.1

Composer 安装命令:

composer require codebider/trait-generator-tool

包简介

A Laravel package to generate trait using an Artisan command.

README 文档

README

Laravel Trait Generator

Packagist Downloads Packagist Version

Laravel Trait Generator

License: MIT

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

📦 Installation

You can install the package via Composer:

composer require codebider/trait-generator-tool

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

'providers' => [
    CodeBider\TraitGenerator\TraitGeneratorServiceProvider::class,
];

⚙️ Configuration (Optional)

You can publish the config and stub file using:

php artisan vendor:publish --provider="CodeBider\TraitGenerator\TraitGeneratorServiceProvider"

This will publish:

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

🧪 Usage

Generate a new trait using:

php artisan make:trait {name}
php artisan make:trait ApiResponser

This will create the trait in the configured path named as InventoryService (default: app/Traits).

🛠 Configuration Options

File: config/trait-generator.php

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

✏️ Custom Stub

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

/stubs/service.stub

The stub supports two variables:

  • {{ namespace }}
  • {{ name }}

Example stub:

<?php

namespace {{ namespace }};

trait {{ name }}
{
    //
}

📄 License

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

👤 Author

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

🤝 Contributing

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

统计信息

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

GitHub 信息

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

其他信息

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