承接 lucasandre-dev/laravel-code-generator 相关项目开发

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

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

lucasandre-dev/laravel-code-generator

最新稳定版本:2.0.2

Composer 安装命令:

composer create-project lucasandre-dev/laravel-code-generator

包简介

Code generator from templates

README 文档

README

A simple code generator for Laravel projects to streamline development.

🚀 Installation and Configuration

  1. Install via Composer

    composer require lucasandre-dev/laravel-code-generator
  2. Publish the Service Provider Register the service provider in your config/app.php file:

    'providers' => [
        // Other Service Providers...
        LucasandreDev\LaravelCodeGenerator\Providers\CodeGeneratorProvider::class,
    ],

    Note:
    For Laravel versions <= 10: Registering Providers in Laravel 10
    For Laravel versions >= 11: Registering Providers in Laravel 11

  3. Publish Configuration and Mockups

    • Config File:
      php artisan vendor:publish --tag=templates-code-generator-config
    • Mockups:
      php artisan vendor:publish --tag=templates-code-generator-mockups
  4. Add Filesystem Configuration Add the following configuration to config/filesystems.php:

    'templates' => [
        'driver' => 'local',
        'root' => base_path(),
        'throw' => true,
    ],
  5. Configure Template Generator Modify the configuration in config/templates-code-generator.php to suit your needs.

  6. Run Code Generation Command Execute the following command to generate code:

    php artisan code:generate

    Note:
    When running the command, you'll be prompted to provide an entity name and a template name.

📚 Documentation

🔧 Configuration File (config/templates-code-generator.php)

  • disk: Disk used for storing generated files.
  • base_destination: Base path for all generated files.
  • template_default: Default template used by the command to generate code.
  • templates: List of templates with operations, template locations, and final dynamic destinations.

📑 Templates

Replacements:

  • %EntityNamespace%: Recommended usage in the mockups namespace.
  • %PascalCase%: The entity name in PascalCase format.
  • %camelCase%: The entity name in camelCase format.

🛠️ Artisan Commands

code:generate

Options:

  • --force: Force overwrite of existing files (use with caution).

Prompts:

  • Entity: Name of the entity to be created. Allows subpaths (e.g., Path1/Path2/EntityName).
  • Template: Select a template number from the options suggested in the terminal.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-11