Download the PHP package ngodingskuyy/laravel-module-generator without Composer
On this page you can find all versions of the php package ngodingskuyy/laravel-module-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ngodingskuyy/laravel-module-generator
More information about ngodingskuyy/laravel-module-generator
Files in ngodingskuyy/laravel-module-generator
Package laravel-module-generator
Short Description Modular CRUD Generator for Laravel + Vue + Tailwind (shadcn-vue)
License MIT
Homepage https://github.com/ilhamridho04/laravel-module-generator
Informations about the package laravel-module-generator
Laravel Module Generator v4.2
๐ Laravel 12+ Focused Module Generator
Modular CRUD Generator for Laravel + Vue + Tailwind (shadcn-vue) - Optimized for Laravel 12+ with PHP 8.2+
Version 4.2 is a complete refactor focused exclusively on Laravel 12+ with comprehensive testing, improved code generation, and modern best practices.
๐ Requirements
- PHP: ^8.2
- Laravel: ^12.0
- Spatie Laravel Permission: ^6.0
๐ฆ Installation
Quick Installation
โ ๏ธ If You Encounter Version Conflicts
Due to older versions on Packagist, you might need to install from source:
For detailed troubleshooting, see DEVELOPMENT.md
๐ Features
โจ What's New in v4.2
- ๐ฏ Laravel 12+ Focused: Exclusively optimized for Laravel 12+ and PHP 8.2+
- ๐งช Comprehensive Testing: 37 tests with 164 assertions (100% pass rate)
- ๐ง Enhanced Code Generation: Improved stub rendering with better error handling
- ๐ Bug-Free Components: All generated files are validated and working
- ๐ Better Project Structure: Cleaner organization and modern conventions
- ๐ CI/CD Ready: Full GitHub Actions workflow for automated testing
๏ฟฝ Core Features
- โ Full CRUD Generation: Model, migration, controller, requests, Vue components, routes, permission seeder
- ๐ฆ Modular Architecture: Better separation of concerns per feature
- ๐จ Modern Frontend: Vue 3 + TailwindCSS + shadcn-vue components
- ๐ Permission System: Auto-generated permissions using Spatie Laravel Permission
- ๐งฐ Customizable Stubs: Fully customizable templates with intelligent fallback support
- ๐ง Optional Components: Generate factories, policies, observers, enums, and tests on demand
๏ฟฝ Requirements
- PHP: ^8.2
- Laravel: ^11.0
- Spatie Laravel Permission: ^6.0
๏ฟฝ๐ฆ Installation
For local development/testing:
Then:
๐ง Usage
Basic Usage
With Optional Components
Force Overwrite Existing Files
๐๏ธ Deleting Features
Delete Basic Feature
Delete with Optional Components
Delete All Components (including optional)
Force Delete (no confirmation)
What Gets Deleted
The delete:feature
command will remove:
- Core Files: Model, Controller, Requests, Vue components, Routes, Migration, Permission seeder
- Optional Components: Enum, Observer, Policy, Factory, Test files (if specified with
--with
or--all
) - Empty Directories: Automatically cleans up empty directories after deletion
- Service Provider: Removes observer registration from AppServiceProvider (if applicable)
โ ๏ธ Warning: This action is irreversible. Make sure to backup your files or use version control.
๐ Auto-Loading Module Routes
Setup Modules Auto-Loader
Install and Integrate Auto-Loader
Manual Integration
Add this line to your routes/web.php
or routes/app.php
(Laravel 11+):
How It Works
The modules auto-loader automatically discovers and loads all web.php
files from subdirectories in routes/Modules/
:
Benefits:
- โ Automatic Discovery: No need to manually register each module's routes
- โ
Laravel 11+ Compatible: Works with both
routes/app.php
androutes/web.php
- โ Performance: Only loads routes for existing modules
- โ Clean Organization: Keeps routes organized by feature/module
Generated Files Structure
Running php artisan make:feature User
will generate:
๐ API Documentation
Commands Overview
The Laravel Module Generator provides four main commands for complete feature lifecycle management:
Command | Description | Purpose |
---|---|---|
make:feature |
Generate complete CRUD feature | Create new features |
delete:feature |
Remove complete CRUD feature | Clean up features |
setup:modules-loader |
Create modular route loader | Setup route automation |
install:modules-loader |
Install route loader into Laravel | Integrate with Laravel routing |
๐ make:feature
Command
Signature: make:feature {name} {--with=*} {--force}
Description
Generates a complete CRUD feature with all necessary files including models, controllers, views, migrations, routes, and permissions.
Arguments
Argument | Type | Required | Description |
---|---|---|---|
name |
string | Yes | The name of the feature to generate (PascalCase) |
Options
Option | Type | Default | Description |
---|---|---|---|
--with |
array | [] |
Optional components to include |
--force |
flag | false |
Overwrite existing files without confirmation |
Optional Components (--with
)
Component | Description | Generated Files |
---|---|---|
factory |
Model factory for testing | database/factories/{Name}Factory.php |
policy |
Authorization policy | app/Policies/{Name}Policy.php |
observer |
Model observer | app/Observers/{Name}Observer.php |
enum |
Status enum class | app/Enums/{Name}StatusEnum.php |
test |
Feature test class | tests/Feature/{Name}Test.php |
Generated Files (Core)
Usage Examples
Return Codes
Code | Meaning |
---|---|
0 |
Success - All files generated successfully |
1 |
Error - Missing required arguments or validation failed |
2 |
Error - File already exists and --force not specified |
๐๏ธ delete:feature
Command
Signature: delete:feature {name} {--with=*} {--all} {--force}
Description
Safely removes all files associated with a feature, including optional components and empty directories.
Arguments
Argument | Type | Required | Description |
---|---|---|---|
name |
string | Yes | The name of the feature to delete (PascalCase) |
Options
Option | Type | Default | Description |
---|---|---|---|
--with |
array | [] |
Optional components to delete |
--all |
flag | false |
Delete all components (core + optional) |
--force |
flag | false |
Delete without confirmation prompt |
Deletion Scope
Core Files (always deleted):
- Model, Controller, Requests
- Vue Components (Index, Create, Edit, Show)
- Migration, Routes, Permission Seeder
Optional Files (with --with
or --all
):
- Factory, Policy, Observer, Enum, Test files
Directory Cleanup:
- Removes empty directories after file deletion
- Maintains directory structure if other files exist
Usage Examples
Interactive Confirmation
When --force
is not used, the command shows:
- List of files to be deleted
- Confirmation prompt
- Deletion progress with status for each file
Return Codes
Code | Meaning |
---|---|
0 |
Success - All specified files deleted |
1 |
Error - Feature not found or validation failed |
2 |
Cancelled - User declined confirmation |
๐ setup:modules-loader
Command
Signature: setup:modules-loader {--force}
Description
Creates the modular route loader file that automatically discovers and loads route files from the routes/modules/
directory.
Options
Option | Type | Default | Description |
---|---|---|---|
--force |
flag | false |
Overwrite existing modules.php file |
Generated Files
Features
- Auto-discovery: Recursively scans
routes/modules/
directory - Performance optimized: Only loads existing files
- Nested support: Handles subdirectories automatically
- Cache compatible: Works with Laravel's route caching
Usage Examples
Generated Code Structure
The generated routes/modules.php
contains:
- File existence checks for performance
- Recursive directory scanning
- Automatic route file inclusion
- Error handling for missing directories
โ๏ธ install:modules-loader
Command
Signature: install:modules-loader {--force}
Description
Integrates the modules loader into Laravel's main routing system by adding the include statement to routes/web.php
.
Options
Option | Type | Default | Description |
---|---|---|---|
--force |
flag | false |
Add include even if already exists |
Modifications
File Modified: routes/web.php
Added Code:
Usage Examples
Integration Process
- Checks if
routes/modules.php
exists - Scans
routes/web.php
for existing installation - Adds include statement if not present
- Provides status feedback
๐๏ธ Module Directory Structure
After setting up the modular loader system:
Route File Example
routes/modules/products.php
:
๐ง Advanced Configuration
Custom Stub Files
You can publish and customize the stub templates:
Stub File Locations
Environment Considerations
Development:
- Use
--force
flag cautiously to avoid overwriting customizations - Test generated code before committing
- Run tests after generation:
vendor/bin/phpunit
Production:
- Install as
--dev
dependency only - Don't include in production builds
- Use route caching:
php artisan route:cache
๐งช Testing Integration
Generated Test Files
When using --with=test
, generates:
Running Tests
๐จ Error Handling
Common Issues & Solutions
File Already Exists:
Permission Denied:
Stub File Missing:
Route Not Loading:
Debug Commands
๐งช Comprehensive Testing (New in v4.2)
๐ฏ Test Suite Overview
Version 4.2 includes a comprehensive test suite with 37 tests and 164 assertions achieving 100% pass rate:
Unit Tests
ServiceProviderTest
- Package registration and command availabilityMakeFeatureCommandUnitTest
- Command structure and signature validationStubFilesTest
- All stub files validation and placeholder checkingStubRenderingTest
- Stub rendering and replacement logic
Feature Tests
MakeFeatureCommandTest
- File generation and content validationMakeFeatureCommandIntegrationTest
- End-to-end command testing
Integration Tests
- Real Laravel app integration
- Command execution in isolated environment
- Generated file validation
- Optional component testing
๐ GitHub Actions CI/CD
Automated testing pipeline with comprehensive validation:
Pipeline Features:
- โ Matrix Testing: PHP 8.2, 8.3 ร Laravel 12
- โ Package Validation: Composer.json validation, syntax checking
- โ Laravel Integration: Fresh Laravel 12 app testing
- โ
Command Testing: Verify
make:feature
functionality with all options - โ File Validation: Ensure all generated files contain correct content
- โ Dependency Testing: Validate Spatie Permission integration
๐โโ๏ธ Local Testing
Run Complete Test Suite
Test Coverage
๐ Test Validation
The test suite validates:
- Stub File Integrity: All stubs exist and contain required placeholders
- Code Generation: Generated files have correct syntax and structure
- Command Options:
--force
and--with
options work correctly - Vue Components: All Vue files have proper template structure
- Database Integration: Migrations and seeders are properly generated
- Permission System: Spatie Laravel Permission integration works
- Package Registration: Service provider loads correctly in Laravel
Run with Coverage
Testing in Real Laravel App
CI Pipeline Status
The workflow tests:
- Package Validation - Syntax, dependencies, composer.json
- Laravel Integration - Install package in fresh Laravel 11
- Command Execution - Run
make:feature
and verify file creation - Laravel Compatibility - Ensure no conflicts with Laravel core
๐ Migration from v3.x to v4.2
โ ๏ธ Breaking Changes
Version 4.2 includes breaking changes focused on Laravel 12+ support:
- PHP Version: Minimum PHP 8.2 required
- Laravel Version: Only Laravel 12+ supported
- Dependencies: Updated to latest versions
๐ Migration Steps
-
Update PHP Version
-
Update Laravel Version
-
Update Package
-
Update Spatie Permission
- Clear and Rebuild
๐ท๏ธ Legacy Support
- Laravel 8-11: Use v3.x branch
- PHP 7.4-8.1: Use v3.x branch
- See 3.x documentation
๐ค Contributing
We welcome contributions! Please feel free to submit a Pull Request.
Development Setup
- Fork the repository
- Clone your fork:
git clone https://github.com/yourusername/laravel-module-generator
- Install dependencies:
composer install
- Run tests:
./vendor/bin/phpunit
- Make your changes and test thoroughly
- Submit a pull request
๐ Contribution Guidelines
- Ensure all tests pass (
vendor/bin/phpunit
) - Follow PSR-12 coding standards
- Add tests for new features
- Update documentation as needed
- Keep backwards compatibility where possible
๏ฟฝ๐ License
MIT ยฉ 2025 NgodingSkuyy
Laravel Module Generator v4.2 - Focused on Laravel 12+, Enhanced with Comprehensive Testing, Built for Modern PHP Development