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
-
Install via Composer
composer require lucasandre-dev/laravel-code-generator
-
Publish the Service Provider Register the service provider in your
config/app.phpfile:'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 -
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
- Config File:
-
Add Filesystem Configuration Add the following configuration to
config/filesystems.php:'templates' => [ 'driver' => 'local', 'root' => base_path(), 'throw' => true, ],
-
Configure Template Generator Modify the configuration in
config/templates-code-generator.phpto suit your needs. -
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
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-11