PHPackages                             saeedvir/laravel-modular - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. saeedvir/laravel-modular

ActiveLibrary[Framework](/categories/framework)

saeedvir/laravel-modular
========================

A powerful modular architecture package for Laravel applications with auto-discovery, composer merge support, and comprehensive artisan commands

v1.3.1(4mo ago)261191MITPHPPHP ^8.2

Since Nov 5Pushed 4mo agoCompare

[ Source](https://github.com/saeedvir/laravel-modular)[ Packagist](https://packagist.org/packages/saeedvir/laravel-modular)[ Docs](https://github.com/saeedvir/laravel-modular)[ RSS](/packages/saeedvir-laravel-modular/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)Dependencies (4)Versions (6)Used By (0)

Laravel Modular
===============

[](#laravel-modular)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d6a974e52b4167fd4b9df511857520d39704e7d80035db291c07330720f9d3fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616565647669722f6c61726176656c2d6d6f64756c61722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/saeedvir/laravel-modular)[![Total Downloads](https://camo.githubusercontent.com/797e77b776dd337380ef4a12e35fe139ed562d88d0506b534d6d0e50767137b1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73616565647669722f6c61726176656c2d6d6f64756c61722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/saeedvir/laravel-modular)[![License](https://camo.githubusercontent.com/85bd664d4864a0396a8fd1b2a6a798f929e31662bf5ca6d26fb8dd74191b2d09/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73616565647669722f6c61726176656c2d6d6f64756c61722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/saeedvir/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**.

- [Document for LLMs and AI code editors](https://context7.com/saeedvir/laravel-modular)
- [Chat with AI for This Package](https://context7.com/saeedvir/laravel-modular?tab=chat)
- [حمایت مالی از من](https://reymit.ir/saeedvir)

✨ Features
----------

[](#-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_DEBUG` for production-friendly logs
- 🧪 **Testing Support** - Built-in infrastructure for module testing
- 🎯 **Laravel 11 &amp; 12** - Full support for modern Laravel versions

📋 Requirements
--------------

[](#-requirements)

- PHP ^8.2
- Laravel ^11.0 or ^12.0
- Composer

📦 Installation
--------------

[](#-installation)

Install the package via composer:

```
composer require saeedvir/laravel-modular
```

The package will automatically register itself via Laravel's package auto-discovery.

**Configure composer merge plugin** in your root `composer.json`:

```
{
    "extra": {
        "merge-plugin": {
            "include": ["modules/*/composer.json"]
        }
    },
    "config": {
        "allow-plugins": {
            "wikimedia/composer-merge-plugin": true
        }
    }
}
```

Publish the configuration file (optional):

```
php artisan vendor:publish --tag=module-config
```

**📖 For detailed installation instructions, troubleshooting, and setup guide, see:**
**[Installation Guide](docs/INSTALLATION.md)**

🚀 Quick Start
-------------

[](#-quick-start)

### Create Your First Module

[](#create-your-first-module)

```
php artisan module:make Blog
composer dump-autoload
```

This creates a complete module structure:

```
modules/Blog/
├── app/
│   ├── Console/
│   ├── Http/
│   │   ├── Controllers/
│   │   ├── Middleware/
│   │   └── Requests/
│   ├── Models/
│   ├── Providers/
│   │   └── BlogServiceProvider.php
│   └── Services/
├── config/
│   └── config.php
├── database/
│   ├── migrations/
│   ├── seeders/
│   └── factories/
├── resources/
│   ├── views/
│   └── lang/
├── routes/
│   ├── web.php
│   └── api.php
└── composer.json

```

```
php artisan module:list
```

### Check Module Status

[](#check-module-status)

```
php artisan module:status
```

### Remove a Module

[](#remove-a-module)

```
php artisan module:remove Blog
```

📖 Usage
-------

[](#-usage)

### Creating Controllers

[](#creating-controllers)

```
php artisan module:controller Blog PostController
```

### Creating Models

[](#creating-models)

```
php artisan module:make-model Blog Post --migration --factory --seeder
```

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:

```
