Download the PHP package saeedvir/laravel-modular without Composer
On this page you can find all versions of the php package saeedvir/laravel-modular. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download saeedvir/laravel-modular
More information about saeedvir/laravel-modular
Files in saeedvir/laravel-modular
Package laravel-modular
Short Description A powerful modular architecture package for Laravel applications with auto-discovery, composer merge support, and comprehensive artisan commands
License MIT
Homepage https://github.com/saeedvir/laravel-modular
Informations about the package laravel-modular
Laravel Modular
A powerful modular architecture package for Laravel applications that allows you to organize your codebase into independent, reusable modules with automatic discovery and zero configuration.
✨ Features
- 📦 Zero Configuration - Modules are automatically discovered and registered via composer merge plugin
-
💾 Automatic Persistence - Module enable/disable states are automatically saved and restored
- ⚡ Performance Optimized - Built-in caching and lazy loading for production use
-
⚡ (saeedvir/laravel-modular 🆚 nWidart/laravel-modules) Peak memory: Improved by 23.1% and Memory usage improved by 10.2%
- 🎨 Complete Module Structure - Controllers, models, views, routes, migrations, translations
- 🔧 Artisan Commands - Comprehensive CLI tools for module management
- 📊 Performance Monitoring - Track module discovery and operation performance
- 🐛 Debug-Aware Logging - Respects
APP_DEBUGfor production-friendly logs - 🧪 Testing Support - Built-in infrastructure for module testing
- 🎯 Laravel 11 & 12 - Full support for modern Laravel versions
📋 Requirements
- PHP ^8.2
- Laravel ^11.0 or ^12.0
- Composer
📦 Installation
Install the package via composer:
The package will automatically register itself via Laravel's package auto-discovery.
Configure composer merge plugin in your root composer.json:
Publish the configuration file (optional):
📖 For detailed installation instructions, troubleshooting, and setup guide, see:
Installation Guide
🚀 Quick Start
Create Your First Module
This creates a complete module structure:
Check Module Status
Remove a Module
📖 Usage
Creating Controllers
Creating Models
This creates a model in modules/Blog/app/Models/Post.php and optionally generates the associated migration, factory, and seeder.
Alternatively, you can create models manually:
Adding Routes
In modules/Blog/routes/web.php:
Note: All routes are automatically prefixed with the module name (
/blog/in this case). See Routing Guide for details.
Using Views
Create views in modules/Blog/resources/views/ and load them:
Migrations
Create migrations in your module:
Run migrations:
Testing
Generate a test for your module:
Run tests for a specific module or all modules:
🎯 Advanced Features
Module Configuration
Each module can have its own configuration file in config/config.php:
Access module config:
Register Livewire Components in Module Service Providers
usage :
Disabling Modules
You can easily enable or disable modules using Artisan commands. These states are automatically persisted in modules/modules.json.
Alternatively, you can manually list modules to be disabled in config/module.php:
Note: The persistent state in
modules.jsontakes precedence over theconfig/module.php'sdisabledarray.
Performance Optimization
The package includes built-in caching:
Debug Mode
When APP_DEBUG=true, the package logs:
- Module discovery events
- Cache operations
- Module creation/deletion
- Performance metrics
When APP_DEBUG=false (production), only errors are logged.
🛠️ Available Commands
| Command | Description |
|---|---|
module:make |
Create a new module |
module:list |
List all modules |
module:remove |
Remove a module |
module:make-controller |
Create a controller in a module |
module:make-model |
Create a model in a module |
module:make-test |
Create a test class in a module |
module:make-request |
Create a form request in a module |
module:make-resource |
Create an API resource in a module |
module:make-migration |
Create a migration in a module |
module:make-factory |
Create a model factory in a module |
module:make-seeder |
Create a database seeder in a module |
module:enable |
Enable a specific module |
module:disable |
Disable a specific module |
module:status |
Show status of all modules |
module:test |
Run tests for a specific module |
module:cache |
Manage module discovery cache |
module:optimize |
Optimize module discovery for production |
⚙️ Configuration
The config/module.php file provides extensive configuration options:
📚 Documentation
- Installation Guide - Complete installation and setup
- Routing Guide - Module routing and automatic prefixing ⭐
- Debug Logging - Debug mode and logging configuration
- Performance Optimization - Performance tips and caching
- Enhancement Summary - Feature enhancements and improvements
🆚 Comparison with nWidart/laravel-modules
Both packages provide modular architecture for Laravel, but with different approaches:
Laravel Modular (This Package)
Philosophy: Zero-configuration with native Composer integration
✅ Advantages:
- Zero Configuration - Uses
wikimedia/composer-merge-pluginfor automatic autoloading - Native Composer - Works with standard Composer workflows
- Automatic Discovery - No manual registration needed
- Performance Focused - Built-in caching and performance monitoring
- Debug-Aware Logging - Respects
APP_DEBUGfor production - Simpler Structure - Standard Laravel conventions
- Less Overhead - Minimal abstraction layer
- Composer-First - Each module has its own
composer.json
Best For:
- Projects that prefer Composer-native solutions
- Teams familiar with standard Laravel structure
- Applications requiring high performance
- Projects with frequent module changes
nWidart/laravel-modules
Philosophy: Feature-rich with extensive abstisan commands
✅ Advantages:
- More Commands - Extensive artisan command set
- Asset Management - Built-in asset publishing
- Module Status - Enable/disable modules dynamically
- Established - Mature package with large community
- More Features - Additional abstractions and helpers
Best For:
- Projects needing extensive CLI tools
- Applications with complex module management needs
- Teams wanting more built-in features
Feature Comparison
| Feature | Laravel Modular | nWidart/laravel-modules |
|---|---|---|
| Autoloading | Composer merge plugin | Custom autoloader |
| Setup Complexity | Minimal | Moderate |
| Module Discovery | Automatic | Manual registration |
| Performance | Optimized with caching | Standard |
| Composer Integration | Native | Custom |
| Debug Logging | Environment-aware | Standard |
| Learning Curve | Low (standard Laravel) | Moderate |
| Module Structure | Laravel conventions | Custom structure |
| Asset Management | Standard Laravel | Built-in system |
| CLI Commands | 17 essential commands | 40+ commands |
| Community | Growing | Established |
| Package Size | Lightweight | Full-featured |
When to Choose Laravel Modular
Choose this package if you:
- ✅ Want zero-configuration setup
- ✅ Prefer native Composer workflows
- ✅ Need optimal performance
- ✅ Like standard Laravel conventions
- ✅ Want minimal overhead
- ✅ Use
composer dump-autoloadworkflow
When to Choose nWidart/laravel-modules
Choose nWidart if you:
- ✅ Need extensive artisan commands
- ✅ Want built-in asset management
- ✅ Require dynamic module enable/disable
- ✅ Prefer feature-rich solutions
- ✅ Need established community support
Migration from nWidart
Migrating is straightforward:
- Module structure is similar (both use MVC)
- Routes and views work the same way
- Main difference is autoloading (Composer vs custom)
- Our Installation Guide covers setup
Both packages are excellent choices - pick based on your project's needs! 🎯
🧪 Testing
🤝 Contributing
Please see CONTRIBUTING for details on how to contribute to this project.
📝 Changelog
Please see CHANGELOG for more information on what has changed recently.
🔒 Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
👥 Credits
- saeed
- All Contributors
📄 License
The MIT License (MIT). Please see License File for more information.
💡 Examples
Blog Module Example
🌟 Why Laravel Modular?
- Scalability: Organize large applications into manageable modules
- Reusability: Share modules across projects
- Maintainability: Clear separation of concerns
- Team Collaboration: Teams can work on different modules independently
- Performance: Optimized for production with caching and lazy loading
- Modern: Built for Laravel 11 & 12 with PHP 8.2+
📊 Performance
- Module Discovery: ~15-20ms (cached)
- Autoloading: Native composer PSR-4 (optimal performance)
- Memory Usage: Minimal overhead with lazy loading
- Production Ready: Designed for high-traffic applications
Built with ❤️ for the Laravel community
If you find this package helpful, please consider giving it a ⭐ on GitHub!
All versions of laravel-modular with dependencies
illuminate/support Version ^11.0|^12.0
wikimedia/composer-merge-plugin Version ^2.1