Download the PHP package hatchyu/laravel-modular-lite without Composer
On this page you can find all versions of the php package hatchyu/laravel-modular-lite. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hatchyu/laravel-modular-lite
More information about hatchyu/laravel-modular-lite
Files in hatchyu/laravel-modular-lite
Package laravel-modular-lite
Short Description Lightweight, zero-ceremony modular architecture for Laravel applications with automatic discovery, compiled caching, and familiar conventions
License MIT
Informations about the package laravel-modular-lite
Laravel Modular Lite
A lightweight, zero-ceremony Modular Architecture package for Laravel applications. Designed for developers who want the organizational benefits of feature-based modules without the cognitive overhead of complex enterprise abstractions.
[!TIP] Building an Enterprise Application?
If you are building large-scale, complex enterprise platforms (ERP, CRM, Banking, Multi-domain systems) requiring strict Domain-Driven Design (DDD) 4-layer boundaries, CQRS (Actions/Queries/Data), and architectural testing, check out our flagship enterprise package:
πhatchyu/laravel-modular(composer require hatchyu/laravel-modular)
π― Design Philosophy: Stay Close to Laravel
If you are building an MVP, SaaS, eCommerce store, or internal tool, you don't always need 7 architectural layers (Domain Model, Contract, Repository, DTO, Action, Request, Resource, Controller) for a simple database record.
Laravel Modular Lite gives you:
- π Familiar Laravel Structure: Put your
Models,Controllers,Requests,Resources, andServicesin clean module folders. - β‘ Compiled Module Discovery: Eliminate runtime filesystem scanning in production with compiled manifest caching (
php artisan module:cache). - π οΈ Frictionless CRUD: Generate an entire vertical CRUD slice (
Model,Migration,Factory,Requests,Resource,Controller,Routes, andTests) in a single command. - π©Ί Self-Healing Diagnostics: Built-in
php artisan module:doctorto verify PSR-4 mappings, check route syntax, and repair missing directories automatically with--fix. - π Module Enable / Disable: Toggle modules on or off dynamically without deleting code (
php artisan module:enable/module:disable). - πΈοΈ Dependency Graph & Topological Booting: Declare dependencies in
module.json. Prerequisite modules boot before dependent ones automatically. - π‘οΈ Fail-Safe Dependency Guardrails: Runtime checks and CLI guardrails prevent broken states when dependencies are disabled or missing.
- π Safe Module Renaming: Rename modules and refactor namespaces, routes, views, providers, and other modules' dependency declarations.
- π Security Hardened: Path traversal immunity, migration table name sanitization, and strict regex module validation.
π Module Structure
When you create a module with php artisan module:make Shop, it generates a clean, conventional directory tree:
π¦ Installation
Install the package via Composer:
Add the modules PSR-4 namespace to your root composer.json:
Then regenerate Composer's autoloader:
(Optional) Publish the configuration file:
π Module Lifecycle & Dependencies
Every module includes a lightweight module.json manifest located at modules/{ModuleName}/module.json (auto-generated by php artisan module:make):
Enabling & Disabling Modules
Easily disable modules during maintenance or feature rollout without altering codebase structure:
When disabled, all of the module's routes, providers, migrations, views, config, and commands are automatically excluded from the application lifecycle.
Topological Boot Ordering
When modules declare dependencies, Laravel Modular Lite automatically sorts them topologically using Kahn's algorithm so that prerequisite modules (e.g., Inventory) are registered and booted before dependent modules (e.g., Shop).
How Disabled or Missing Dependencies Are Handled
If a module depends on another module that is disabled or missing:
-
At Application Boot Time: If
Shopis active but depends on disabledInventory, the system raises an explicit, actionable exception: -
At CLI Level (Dependency Protection):
-
Protection Against Breaking Dependents: You cannot disable a prerequisite module if active modules depend on it:
- Validation on Enable: Enabling a module validates that all required dependencies are present and enabled:
-
- Health Diagnostics (
php artisan module:doctor): Displays module status and flags disabled or missing dependencies directly in the health table.
π Usage & Artisan Commands
1. Module Management
2. Instant CRUD Generation
Generate an entire vertical slice in one command:
This generates:
Models/Product.phpDatabase/Migrations/xxxx_create_products_table.phpDatabase/Factories/ProductFactory.phpRequests/StoreProductRequest.php&UpdateProductRequest.phpResources/ProductResource.phpControllers/Api/ProductController.php(pure Eloquent queries)Tests/Feature/ProductControllerTest.php- Appends
Route::apiResource('products', ProductController::class);toRoutes/api.php
3. Granular Generators
β‘ Production Optimization
In production environments, avoid scanning the filesystem on every request by compiling a discovery manifest:
To clear the compiled cache:
(Integrated with native php artisan optimize and php artisan optimize:clear).
βοΈ When to Choose Lite vs Enterprise
| Need | laravel-modular-lite (This Package) |
laravel-modular (Enterprise) |
|---|---|---|
| Ideal For | Startups, SaaS, eCommerce, CRUD apps | ERP, CRM, Banking, Complex Domains |
| Layering | Simple folders (Models, Controllers, Services) |
Strict 4-Layer DDD (Domain, Application, Interface, Infrastructure) |
| Data Flow | Direct Eloquent queries in controllers/services | CQRS (Actions, Queries, DTOs, Repository Interfaces) |
| Guardrails | Conventional Laravel | Architectural boundary enforcement via Pest Arch |
π§ͺ Testing
π¨ Code Style
π License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-modular-lite with dependencies
illuminate/console Version ^11.0||^12.0||^13.0
illuminate/database Version ^11.0||^12.0||^13.0
illuminate/routing Version ^11.0||^12.0||^13.0
illuminate/support Version ^11.0||^12.0||^13.0
illuminate/view Version ^11.0||^12.0||^13.0