Download the PHP package rawnoq/laravel-hmvc without Composer
On this page you can find all versions of the php package rawnoq/laravel-hmvc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-hmvc
Laravel HMVC Package
A professional, feature-rich Hierarchical Model-View-Controller (HMVC) package for Laravel applications. This package provides a complete modular architecture solution with automatic route loading, view registration, migration management, and comprehensive Artisan command support.
๐ Table of Contents
- Features
- Requirements
- Installation
- Quick Start
- Module Management
- Artisan Commands
- Module Structure
- Configuration
- Advanced Usage
- Examples
- Contributing
- License
โจ Features
Core Features
- โ Complete HMVC Architecture - Organize your application into independent, reusable modules
- โ Automatic Route Loading - Routes are automatically discovered and loaded from modules
- โ View Registration - Module views are automatically registered with Laravel
- โ Translation Support - Automatic language file loading from modules
- โ Migration Management - Module-specific migrations with dedicated commands
- โ Service Provider Support - Each module can have its own service providers
- โ Configuration Management - Module-specific configuration files
- โ Module Status Management - Enable/disable modules dynamically
Artisan Commands
- โ Make Commands - Full support for creating components within modules
- โ Module Management Commands - Create, list, enable, disable modules
- โ Migration & Seeding - Module-specific database operations
- โ Case-Insensitive - Module names work regardless of case
Supported Components
All Laravel make: commands support the --module option:
- Controllers, Models, Requests, Factories, Seeders, Migrations, Policies
- Middleware, Commands, Events, Listeners, Observers
- Resources, Tests, Notifications, Mail, Jobs, Exceptions
- Rules, Casts, Channels, Components, Enums, Scopes
- Views, Classes, Interfaces, Traits, DTOs, Config, Providers, Job Middleware
๐ฆ Requirements
- PHP 8.2 or higher
- Laravel 11.0+ or Laravel 12.0+
๐ Installation
Step 1: Install via Composer
The package will automatically register PSR-4 autoloading for your modules. No manual configuration needed!
Step 2: Publish Configuration (Optional)
This will publish the configuration file to config/hmvc.php.
Step 3: Publish Stubs (Optional)
This will publish module stubs to stubs/hmvc/module/ for customization.
โ ๏ธ Note on Autoloading
The package automatically registers PSR-4 autoloading for the Modules namespace. You do not need to manually add it to your composer.json. The autoloading is registered programmatically and works on both Linux and Windows systems.
๐ฏ Quick Start
Create Your First Module
This command will create a complete module structure:
Create Components Within Modules
๐ Module Management
List All Modules
Output:
Enable/Disable Modules
Run Module Migrations
Run Module Seeders
๐ ๏ธ Artisan Commands
Module Management Commands
| Command | Description |
|---|---|
module:make {name} |
Create a new HMVC module scaffold |
module:list |
List all registered HMVC modules |
module:enable {name} |
Enable a disabled HMVC module |
module:disable {name} |
Disable an HMVC module |
module:migrate {name} |
Run database migrations for a specific module |
module:seed {name} |
Run the database seeder for a specific module |
Module Options
The module:make command supports several options:
Make Commands with Module Support
All Laravel make: commands support the --module option:
Basic Components
Database Components
Event System
Jobs & Queues
API & Resources
Notifications & Mail
Validation & Rules
Broadcasting
View Components
Other Components
Note: All commands work normally without --module option (standard Laravel behavior).
๐ Module Structure
A typical module structure looks like this (matching Laravel's standard structure):
โ๏ธ Configuration
The configuration file is located at config/hmvc.php:
Customizing Module Directories
You can customize the directory structure in config/hmvc.php:
๐ Advanced Usage
Module Service Providers
Each module can have its own service provider located at Providers/ServiceProvider.php:
Registering Class Aliases
The package provides two ways to register class aliases:
1. Using the Helper Function (Recommended):
Single alias:
Multiple aliases at once (snake_case):
Multiple aliases at once (camelCase):
Note: Both register_class_aliases() (snake_case) and registerClassAliases() (camelCase) are available. Use whichever naming convention you prefer.
2. Using the Trait:
Benefits:
- Allows modules to reference classes by a consistent name
- Actual implementation can be swapped via configuration
- Prevents duplicate alias registration
- Type-safe and maintainable
Module Routes
Web Routes (routes/web.php)
API Routes (routes/api.php)
Module Views
Views are automatically registered with the module name as namespace:
Module Translations
Translation files are automatically loaded:
Module Migrations
Migrations are automatically discovered and can be run with:
Or run all migrations (including modules):
Module Configuration
Access module configuration:
๐ Examples
Example 1: Complete Blog Module
Example 2: API Module with Events
Example 3: E-commerce Module
๐ง Troubleshooting
Module Not Found
If you get "Module does not exist" error:
- Check module name (case-insensitive)
- Verify module exists in
modules/directory - Run
php artisan module:listto see all modules
Routes Not Loading
- Ensure module is enabled:
php artisan module:enable ModuleName - Check route files exist:
modules/ModuleName/routes/web.phporapi.php - Clear route cache:
php artisan route:clear
Views Not Found
- Verify view files exist in
modules/ModuleName/Resources/views/ - Use correct namespace:
module-name::view.name - Clear view cache:
php artisan view:clear
๐งช Testing
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Please see CONTRIBUTING.md for more details.
๐ License
This package is open-sourced software licensed under the MIT license.
๐ฆ Data Transfer Objects (DTOs)
The package includes a powerful DTO system with a base class for type-safe data transfer:
Creating DTOs
DTO Structure
All DTOs extend Rawnoq\HMVC\DTOs\BaseDto which provides:
fromArray(array $data): static- Create DTO from arrayfromRequest(Request $request): static- Create DTO from validated requesttoArray(): array- Convert DTO to array
Example DTO
Using DTOs
๐ Credits
- Author: Rawnoq
- Package: rawnoq/laravel-hmvc
- Version: 1.0.3
๐ Additional Resources
Made with โค๏ธ for the Laravel community
All versions of laravel-hmvc with dependencies
illuminate/support Version ^11.0|^12.0
illuminate/console Version ^11.0|^12.0
illuminate/filesystem Version ^11.0|^12.0
illuminate/routing Version ^11.0|^12.0