定制 grazulex/laravel-turbomaker 二次开发

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

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

grazulex/laravel-turbomaker

最新稳定版本:v2.1.0

Composer 安装命令:

composer require grazulex/laravel-turbomaker

包简介

Laravel TurboMaker is a productivity-focused package designed to supercharge your Laravel development workflow. With a single command, you can scaffold complete modules (models, migrations, controllers, routes, tests, views, and more) following best practices. It saves hours of repetitive setup work

README 文档

README

Laravel TurboMaker

Supercharge your Laravel development workflow with instant module scaffolding.

Latest Version Total Downloads License PHP Version Laravel Version Tests Code Style

Laravel TurboMaker is a productivity-focused package designed to save hours of repetitive setup work.
With a single command, you can scaffold complete modules (models, migrations, controllers, routes, tests, views, policies, factories...) following Laravel best practices.

✨ Features

  • ⚡ One-command scaffolding – Generate a full CRUD or API module instantly
  • 📋 Schema-based generation – Define models with YAML schemas for complex projects
  • 📦 Complete structure – Models, controllers, migrations, requests, resources, views & tests
  • 🔒 Security ready – Generates Policies and authentication hooks out of the box
  • 🧪 Built-in testing – Pest tests automatically generated for each action
  • 🔌 Extensible field types – 65+ built-in types + create custom field types
  • ⚙️ Advanced generators – Actions, Services, Rules, Observers for clean architecture
  • 🎨 Custom templates – Override stubs and templates to match your coding style
  • 🌐 API & Web ready – Separate API Resources & Controllers when needed
  • 🚀 Laravel 11+ compatible – Auto-detection and smart configuration

📦 Installation

composer require --dev grazulex/laravel-turbomaker

Requirements:

  • PHP 8.3+
  • Laravel 11.x | 12.x

🚀 Quick Start

Generate Complete Module

php artisan turbo:make Post

What's Generated:

  • Model: app/Models/Post.php with relationships
  • Controllers: Web & API controllers with CRUD operations
  • Migrations: Database table with proper columns and indexes
  • Form Requests: Validation for Store/Update operations
  • API Resources: JSON transformations for API responses
  • Views: Complete CRUD views (index, create, edit, show)
  • Routes: Both web and API routes with correct naming
  • Tests: Feature and unit tests using Pest framework
  • Factory: Model factory for testing and seeding

Schema-Based Development

# Create a schema file
php artisan turbo:schema create Product --fields="name:string,price:decimal,category_id:foreignId"

# Generate from schema
php artisan turbo:make Product --schema=Product

API-First Development

php artisan turbo:api Product --tests --policies

Generates API-only components (no views) with authentication and authorization.

Add Relationships

php artisan turbo:make Comment --belongs-to=Post --belongs-to=User

Automatically handles foreign keys, model relationships, and form integration.

📚 Documentation & Examples

📖 Complete documentation and examples have been moved to the GitHub Wiki

Quick Links:

Section Description
🚀 Getting Started Installation, setup and your first module
📋 Command Reference Complete command documentation
🔗 Working with Relationships Model relationships guide
🎨 Custom Templates Customize generated code
⚙️ Configuration Configure TurboMaker settings
🏢 Advanced Usage Complex patterns and enterprise features
💡 Real-World Examples Blog, E-commerce, API projects

🔧 Available Commands

Command Purpose Example
turbo:make Complete module generation turbo:make Post --tests --factory
turbo:api API-only module turbo:api Product --policies
turbo:schema Schema management turbo:schema create User --fields="name:string,email:email"

➡️ See complete command reference

🏭 Enterprise Features

ModelSchema Integration

  • 65+ Field Types with automatic validation
  • Fragment Architecture for 95% faster generation
  • Enterprise Validation with diff and optimization tools
  • Schema Templates for common patterns (blog, ecommerce, etc.)

Advanced Generators

  • 13 Generator Types - Models, Controllers, Tests, Policies, etc.
  • Smart Relationships - Automatic foreign keys and model relationships
  • Custom Actions & Services - Clean architecture patterns
  • Validation Rules - Custom validation with type-specific rules

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

git clone https://github.com/grazulex/laravel-turbomaker.git
cd laravel-turbomaker
composer install
./vendor/bin/pest

� License

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

🔗 Related Packages

Made with ❤️ for the Laravel community

Generate Complete Module

php artisan turbo:make Post

What's Generated:

  • Model: app/Models/Post.php with relationships
  • Controllers: Web & API controllers with CRUD operations
  • Migrations: Database table with proper columns and indexes
  • Form Requests: Validation for Store/Update operations
  • API Resources: JSON transformations for API responses
  • Views: Complete CRUD views (index, create, edit, show)
  • Routes: Both web and API routes with correct naming
  • Tests: Feature and unit tests using Pest framework
  • Factory: Model factory for testing and seeding

Schema-Based Development

# Create a schema file
php artisan turbo:schema create Product --fields="name:string,price:decimal,category_id:foreignId"

# Generate from schema
php artisan turbo:make Product --schema=Product

API-First Development

php artisan turbo:api Product --tests --policies

Generates API-only components (no views) with authentication and authorization.

Add Relationships

php artisan turbo:make Comment --belongs-to=Post --belongs-to=User

Automatically handles foreign keys, model relationships, and form integration.

� Documentation & Examples

📖 Complete documentation and examples have been moved to the GitHub Wiki

Quick Links:

Section Description
🚀 Getting Started Installation, setup and your first module
📋 Command Reference Complete command documentation
🔗 Working with Relationships Model relationships guide
🎨 Custom Templates Customize generated code
⚙️ Configuration Configure TurboMaker settings
🏢 Advanced Usage Complex patterns and enterprise features
💡 Real-World Examples Blog, E-commerce, API projects

🏭 13 Enterprise Generators

TurboMaker generates 13 different types of files for complete module scaffolding:

Generator Files Generated Purpose
Model app/Models/{Name}.php Eloquent model with relationships
Migration database/migrations/create_{table}_table.php Database schema
Controllers app/Http/Controllers/{Name}Controller.php Web + API controllers
Requests app/Http/Requests/{Name}/Store{Name}Request.php Form validation
Resources app/Http/Resources/{Name}Resource.php API responses
Factory database/factories/{Name}Factory.php Test data generation
Seeder database/seeders/{Name}Seeder.php Database seeding
Tests tests/Feature/{Name}Test.php Feature + Unit tests
Policies app/Policies/{Name}Policy.php Authorization logic
Observers app/Observers/{Name}Observer.php Model event handlers
Services app/Services/{Name}Service.php Business logic layer
Actions app/Actions/{Name}/ CRUD action classes
Rules app/Rules/{Name}/ Custom validation rules

🔍 Available Commands

Command Purpose Example
turbo:make {name} Generate complete module turbo:make Post --tests --factory
turbo:api {name} API-only module turbo:api Product --policies --tests
turbo:schema {action} Manage YAML schemas turbo:schema create Product --fields="name:string"
turbo:view {name} Views only turbo:view Product
turbo:test {name} Tests only turbo:test User --feature --unit

Key Options

Option Description
--schema=Product Use YAML schema for generation
--fields="name:string,email:email" Quick field definition
--tests Generate Pest tests
--factory Generate model factory
--seeder Generate seeder
--policies Generate policies
--actions Generate action classes
--services Generate service classes
--rules Generate validation rules
--observers Generate model observers
--belongs-to=User Add belongs-to relationship
--has-many=Comment Add has-many relationship
--force Overwrite existing files

🛠 Configuration

Publish the configuration file to customize TurboMaker:

php artisan vendor:publish --tag=turbomaker-config

Publish custom templates:

php artisan vendor:publish --tag=turbomaker-stubs

See the Configuration Wiki for complete details.

🎯 Field Types & Extensibility

TurboMaker includes 65+ built-in field types and supports custom field type creation:

Built-in Types

String Types: string, text, longText, mediumText
Integer Types: integer, bigInteger, unsignedBigInteger, tinyInteger, smallInteger
Numeric Types: decimal, float, double, boolean
Date/Time: date, dateTime, timestamp, time
Geometry: point, lineString, polygon, multiPoint, multiLineString, multiPolygon, geometryCollection
Advanced: json, uuid, email, foreignId, morphs, binary, enum, set, fullText, char, year
MongoDB: objectId, binaryUuid

Custom Field Types

Create your own field types by extending AbstractFieldType:

// config/turbomaker.php
'custom_field_types' => [
    'money' => App\TurboMaker\FieldTypes\MoneyFieldType::class,
    'slug' => App\TurboMaker\FieldTypes\SlugFieldType::class,
],

See the Field Types Wiki for complete documentation.

🆕 Version Compatibility

TurboMaker PHP Laravel
2.x 8.3+ 11.x | 12.x

🤝 Contributing

We welcome contributions! See our Contributing Guide.

Made with ❤️ for the Laravel community

📖 Documentation🐛 Report Issues💬 Discussions

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-30