lac / toolkit
Laravel Arsenal Core (LAC) - A toolkit for standardizing and accelerating Laravel development with automated scaffolding, synchronization, and code generation tools
Requires
- php: ^8.2
- illuminate/support: ^10.0|^11.0|^12.0
- phpoffice/phpspreadsheet: ^4.2
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0|^11.0
README
Laravel Arsenal Core (LAC) is a toolkit for standardizing and accelerating Laravel development with automated scaffolding, synchronization, and code generation tools.
πΊπΈ English (current) | π―π΅ ζ₯ζ¬θͺ
Overview
LAC is a comprehensive toolset that automates repetitive tasks in Laravel development and generates code that follows standardized patterns, resulting in maintainable systems.
π New in v2.0 - Bidirectional Database Design
LAC v2.0 introduces groundbreaking two-way synchronization between PlantUML ER diagrams and Laravel migrations:
- Design First: Create your database schema visually with PlantUML, then generate migrations
- Code First: Write migrations and automatically generate up-to-date ER diagrams
# ER diagram β Migration
php artisan lac:gen-migration
# Migration β ER diagram
php artisan lac:gen-diagram
Features
- Scaffolding: Generate models, controllers, services, requests, views, factories, and seeders with a single command
- Route Syncn: Automatic generation and synchronization of web/API routes based on controllers
- Migration and Excel Integration: Generate Excel templates based on migration files and import data
- Model Relation Sync: Automatically generate model relationships from migration files
- Validation Sync: Automatically generate validation rules for request classes based on database schema
- Bidirectional ER Diagram Sync (New in v2.0): Two-way synchronization between PlantUML diagrams and Laravel migrations
Development Workflow with LAC
LAC enhances your development workflow:
Option 1: Design-First Approach
- Design your database schema with PlantUML
- Generate migrations with
lac:gen-migration
- Generate resources with
lac:scaffold
- Auto-generate routes with
lac:sync-routes
- Update model relationships with
lac:sync-model-rel
- Generate validation rules with
lac:sync-validations
Option 2: Code-First Approach
- Create migration files manually
- Generate ER diagrams with
lac:gen-diagram
for documentation - Generate resources with
lac:scaffold
- Continue with steps 4-6 from above
Test Data Management
- Generate Excel templates with
lac:db-template
- Fill in test data in the Excel files
- Place files in
storage/app/db/imports
directory - Import data with
lac:db-import
Installation
Install LAC via Composer:
composer require lac/toolkit --dev
LAC will be automatically registered through Laravel's service provider auto-discovery.
Requirements
- PHP 8.2 or higher
- Laravel 10.0 or higher
- PhpSpreadsheet 4.2 or higher
Usage
Scaffolding
Generate a complete CRUD resource with a single command:
php artisan lac:scaffold User
Generate multiple resources at once:
php artisan lac:scaffold User Post Comment
Options:
--hard-delete
: Disable soft delete functionality--force
: Overwrite existing files--no-view
: Skip generating view files
scaffold.mp4
Route Synchronization
Automatically generate routes based on controllers:
php artisan lac:sync-routes
Options:
--web
: Web routes only--api
: API routes only
sync-routes.mp4
Excel Template Generation
Generate Excel templates based on database table structure:
php artisan lac:db-template
db-template.mp4
Data Import from Excel
Import data from Excel files into the database: Place Excel files with your data in storage/app/db/imports directory Processed Excel files are automatically moved to storage/app/db/processed directory
php artisan lac:db-import
db-import.mp4
Model Relation Synchronization
Automatically generate model relationships based on migration files:
php artisan lac:sync-model-rel
Synchronize specific models only:
php artisan lac:sync-model-rel User
sync-model-rel.mp4
Validation Synchronization
Generate validation rules for request classes based on database schema:
php artisan lac:sync-validations
Target specific tables only:
php artisan lac:sync-validations --tables=users
sync-validation.mp4
Bidirectional ER Diagram Sync
Generate Migrations from PlantUML
Design your database visually with PlantUML and generate Laravel migrations:
php artisan lac:gen-migration
Please place your .puml file in storage/app/db/diagrams/ directory. Default files searched: schema.puml, er.puml, diagram.puml
β οΈ Important: To ensure perfect bidirectional synchronization, any existing migration files not defined in the PlantUML diagram will be deleted. You'll be prompted for confirmation before deletion.
Generate PlantUML from Migrations
Extract ER diagrams from your existing migration files for documentation:
php artisan lac:gen-diagram
The generated ER file will be stored into storage/app/db/diagrams/generated folder.
Bidirectional-ER-Diagram-Sync.mp4
Architecture Design
LAC follows these design principles:
- Service Classes: Business logic is centralized in service classes
- Repository Pattern: Data access is separated from models and controllers
- Slim Controllers: Controllers focus on request validation and service calls
- Systematic Directory Structure: Files are organized in a consistent structure
License
Released under the MIT License. See the LICENSE file for details.
Author
Contributions are welcome, including bug reports, feature requests, and pull requests.