Download the PHP package alizharb/laravel-modular without Composer
On this page you can find all versions of the php package alizharb/laravel-modular. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alizharb/laravel-modular
More information about alizharb/laravel-modular
Files in alizharb/laravel-modular
Package laravel-modular
Short Description A professional, framework-agnostic modular architecture for Laravel 11+. Features zero-config autoloading, 29+ Artisan command overrides, and seamless Vite integration.
License MIT
Informations about the package laravel-modular
Laravel Modular ๐
Laravel Modular is a professional, framework-agnostic modular system engineered for Laravel 11/12/13. It empowers you to build scalable, strictly typed, and decoupled applications with zero configuration overhead.
We override 29+ native Artisan commands to provide a seamless "first-class" modular experience, feeling exactly like standard Laravel but better.
โจ Features
- ๐๏ธ Native Experience: 29+ Artisan commands (
make:model,make:controller, etc.) fully support--module. - โก Zero Config Autoloading: Intelligent
composer-merge-pluginintegration for isolated module dependencies. - ๐ฆ Topological Sorting: Strict dependency graph resolution ensures base modules always boot before their dependents.
- ๐ Performance First: Built-in discovery caching (
modular:cache) for near-zero overhead in production. - ๐ Dynamic Activation: Enable or disable modules on the fly via
module:enableandmodule:disable. - ๐ Auto-Discovery: Automatic registration of Artisan commands, Policies, and Event Listeners within modules.
- ๐ Decoupled Architecture: Strictly typed
ModuleRegistryand traits for maximum stability. - ๐งญ Production Diagnostics:
modular:doctor,modular:status,modular:debug,modular:graph, andmodular:whymake module state transparent. - ๐ง Laravel Boost Ready: Ships package guidelines and a dedicated Boost skill for AI-assisted modular development.
- ๐งฉ Migration Friendly: Includes
modular:import-nwidartto preview and migrate nwidart-style modules. - โ Laravel 11, 12 & 13 Ready: Optimized for PHP 8.2+ and the latest framework features.
- ๐จ Asset Management: Seamless Vite integration via
modular_vite()and asset linking.
๐ Ecosystem
Enhance your modular application with our official packages:
- Laravel Hooks: specific modular hook system support.
- Filament Integration: Seamless Filament admin panel integration in modules.
- Livewire Integration: First-class Livewire component support in modules.
- Laravel Themer: Advanced theme management system.
๐ Installation
Install the package via Composer:
Preview the installer without writing files:
Run the installation command to automatically configure your application:
Note: This will automatically install and configure
wikimedia/composer-merge-pluginto handle your module dependencies.
Manual Setup
If you prefer to configure things manually, follow these steps:
1. Composer Autoloading
Add the following to your root composer.json to ensure module namespaces are autoloaded:
2. Vite Configuration
To enable hot-reloading for module assets, create a vite.modular.js file in your root and update vite.config.js:
๐ Usage
Creating a Module
Generate a fully structured module in seconds:
Generating Resources
Every standard Laravel make: command acts as a modular command when you pass the --module flag:
Modular Database
Run migrations and seeders specifically for your modules:
Module Management & Utilities
Blade Directives
Use our dedicated Blade directives to conditionally render UI based on module availability:
๐๏ธ Performance Optimization
For maximum production performance, we recommend the following:
- Optimized PSR-4: Ensure
"Modules\\": "modules/"is in your rootcomposer.json.modular:installhandles this for you. - Dependency Syncing: Use
php artisan modular:syncto merge module dependencies into your rootcomposer.jsonand disable the merge-plugin. - Discovery Caching: Always run
php artisan modular:cachein your deployment pipeline. - Cache Refreshing: Use
php artisan modular:refreshwhen deployments reuse build artifacts or cache directories. - Health Checks: Run
php artisan modular:doctor --jsonin CI or deployment validation.
modular:cache stores module metadata, statuses, discovered resources, manifest hashes, dependency hashes, provider lists, and a cache timestamp. modular:doctor warns when cached module manifests no longer match disk.
Middleware & Config
Define middleware in your module.json:
Access config case-insensitively:
Module Manifest
Every module is described by module.json. In v1.2.0, manifests are validated by modular:doctor and exposed through JSON diagnostics.
Use requires for dependency ordering, conflicts for modules that cannot be enabled together, and provides for capabilities a module exposes to the application.
Lifecycle Events
Laravel Modular dispatches lifecycle events for integrations, dashboards, logs, and automation:
ModuleEnablingModuleEnabledModuleDisablingModuleDisabledModularCachedModularRefreshed
๐ง Laravel Boost Support
Laravel Modular ships first-class Laravel Boost resources:
resources/boost/guidelines/core.blade.phpresources/boost/skills/laravel-modular-development/SKILL.md
After installing Laravel Boost in an application, run:
If Laravel Modular was installed after Boost, rediscover package resources:
Boost-aware agents will learn to use native make:* --module commands, respect module boundaries, validate module.json, and run the right diagnostics.
๐ ๏ธ Helpers & Assets
Global Helpers
Access module information globally with strictly typed helpers:
Asset Management
Link your module assets to public/modules for easy serving:
Use the helper to generate asset URLs in your Blade views:
โ๏ธ Configuration
Publish the configuration file for advanced customization:
You can customize:
- Paths: Move modules to
packages/or any custom directory. - Composer: Set default fields (
vendor,author,license) for generatedcomposer.jsonfiles. - Activator: Swap the default module activator for your own implementation.
๐งช Testing
We strictly enforce testing. Use the provided test suite to verify your modules:
For module-level testing:
๐ Ecosystem
Extend your modular architecture with our official ecosystem packages:
| Package | Description |
|---|---|
| Laravel Themer | For advanced theme management support |
| Modular Livewire | Provides automatic Livewire component discovery and registration within modules. |
| Modular JS | Enables JS discovery within modular structures and provides zero-config autoloading for modules. |
| Modular Filament | Enables Filament v5 admin panel integration with automatic discovery in modules. |
| Filament Themer Launcher | Provides a comprehensive Filament v5 interface for managing and switching themes. |
| Filament Modular Launcher | A powerful Filament v5 manager for listing, toggling, and backing up system modules. |
| Laravel Hooks | Adds a universal extensibility and plugin system for Laravel applications. |
โก JavaScript & Vite Integration
We provide first-class support for modern frontend tooling:
- NPM Workspaces: Run
php artisan modular:npmto configure workspaces, allowing each module to manage its ownpackage.jsondependencies efficiently. - Vite Integration: Use the
modular_vite('ModuleName')helper to load module-specific assets with full Hot Module Replacement (HMR) support. - Asset Publishing: Easily publish public assets to the main application with
php artisan modular:link.
๐ Migrating From nwidart/laravel-modules
Laravel Modular v1.2.0 includes a dry-run importer for teams evaluating a move from nwidart/laravel-modules:
The importer is intentionally safe: preview first, import deliberately, then run:
Read the full guide: Migration From nwidart.
๐ Documentation
- Installation
- Commands
- Architecture
- Deployment
- Performance
- CI
- Laravel Boost
- Command Parity
- Comparison
- Roadmap
- v1.2.0 Release Notes
For a copy-ready release note, see RELEASE_NOTES_1.2.0.md.
๐ Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel Modular development. If you are interested in becoming a sponsor, please visit the Laravel Modular GitHub Sponsors page.
๐ค Contributing
We welcome contributions! Please see CONTRIBUTING for details.
- Fork the Project
- 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
๐ Acknowledgments
- Laravel: For creating the most elegant PHP framework.
- Spatie: For setting the standard on Laravel package development.
๐ Security
If you discover any security-related issues, please email Ali Harb at [email protected].
Please see SECURITY for the full security policy.
๐ License
The MIT License (MIT). Please see License File for more information.
Made with โค๏ธ by Ali Harb
All versions of laravel-modular with dependencies
illuminate/contracts Version ^11.0|^12.0|^13.0
spatie/laravel-package-tools Version ^1.16
wikimedia/composer-merge-plugin Version ^2.1