PHPackages                             sinemacula/laravel-modules - 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. sinemacula/laravel-modules

ActiveLibrary[Framework](/categories/framework)

sinemacula/laravel-modules
==========================

A lightweight, convention-driven modular architecture package for Laravel - auto-discovers modules as directories with zero manifests, zero boilerplate, and nothing new to learn.

v1.1.0(1w ago)019Apache-2.0PHPPHP ^8.3CI passing

Since Apr 5Pushed 5d agoCompare

[ Source](https://github.com/sinemacula/laravel-modules)[ Packagist](https://packagist.org/packages/sinemacula/laravel-modules)[ RSS](/packages/sinemacula-laravel-modules/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (53)Versions (8)Used By (0)

Laravel Modules
===============

[](#laravel-modules)

[![Latest Stable Version](https://camo.githubusercontent.com/149f5d486919eb0dcd080439735bcfca34dceace901888f1d88d9921626f3a05/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73696e656d6163756c612f6c61726176656c2d6d6f64756c65732e737667)](https://packagist.org/packages/sinemacula/laravel-modules)[![Build Status](https://github.com/sinemacula/laravel-modules/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/sinemacula/laravel-modules/actions/workflows/tests.yml)[![Quality Gates](https://github.com/sinemacula/laravel-modules/actions/workflows/quality-gates.yml/badge.svg?branch=master)](https://github.com/sinemacula/laravel-modules/actions/workflows/quality-gates.yml)[![Maintainability](https://camo.githubusercontent.com/d20f40809b25b58553e65f1df14c56c99b2f02e7c734e6d6c39a0436614e8975/68747470733a2f2f716c74792e73682f67682f73696e656d6163756c612f70726f6a656374732f6c61726176656c2d6d6f64756c65732f6d61696e7461696e6162696c6974792e737667)](https://qlty.sh/gh/sinemacula/projects/laravel-modules)[![Code Coverage](https://camo.githubusercontent.com/9e7739b7dc66ea0a3e7a8fa8ba04186899f7dc0ca696a9b1dc3b807de04d040b/68747470733a2f2f716c74792e73682f67682f73696e656d6163756c612f70726f6a656374732f6c61726176656c2d6d6f64756c65732f636f7665726167652e737667)](https://qlty.sh/gh/sinemacula/projects/laravel-modules)[![Total Downloads](https://camo.githubusercontent.com/77e1c009c46720baa4f0aa4532fd1ad122822d44ce6a0b958bcd5cd45d2f6a92/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73696e656d6163756c612f6c61726176656c2d6d6f64756c65732e737667)](https://packagist.org/packages/sinemacula/laravel-modules)

A lightweight, convention-driven modular architecture package for Laravel. Replaces the standard `app/` directory with a `modules/` directory where each subdirectory is a self-contained module following standard Laravel conventions.

Modules are auto-discovered at boot time and cached for performance. All standard Laravel conventions work inside each module - there is no new API to learn.

How It Works
------------

[](#how-it-works)

Each subdirectory under `modules/` is a self-contained module with its own models, controllers, routes, commands, listeners, events, observers, policies, and more:

```
modules/
├── Foundation/              # Core framework module
│   ├── Console/             # Commands and schedule
│   └── Providers/           # Service providers
└── Billing/                 # Example domain module
    ├── Events/
    ├── Http/
    │   ├── Controllers/
    │   ├── Requests/
    │   ├── Resources/
    │   └── routes.php
    ├── Listeners/
    ├── Models/
    ├── Observers/
    └── Policies/

```

### What Gets Discovered

[](#what-gets-discovered)

ConventionModule PathHow It's LoadedConsole commands`Console/Commands/`Auto-registered via `withCommands()`Scheduled tasks`Console/schedule.php`Auto-registered via `withCommands()`Event listeners`Listeners/`Auto-registered via `withEvents()`Views`Resources/views/`Auto-registered in `ModuleServiceProvider`Translations`Resources/lang/`Auto-registered in `ModuleServiceProvider`Routes`Http/routes.php`Discovered; you wire them in `bootstrap/app.php`Everything else - controllers, requests, resources, events, observers, policies, models, jobs, mail, notifications - works via PSR-4 autoloading. No registration required.

Service providers work exactly as they do in a standard Laravel app: register them in `bootstrap/providers.php`. The package does not auto-discover module providers, so you keep full control over their registration order.

### Artisan Commands

[](#artisan-commands)

CommandDescription`module:make {name}`Scaffold a new module with the standard directory structure`module:list`List all discovered modules and their paths`module:cache`Cache discovered module paths for faster resolution`module:clear`Clear the cached module paths`module:make Billing` creates:

```
modules/Billing/
├── Console/Commands/
├── Http/
│   ├── Controllers/
│   ├── Requests/
│   └── routes.php
├── Listeners/
└── Models/

```

### Module Caching

[](#module-caching)

Module paths are cached to `bootstrap/cache/modules.php` and integrated into Laravel's `optimize` / `optimize:clear`lifecycle:

```
php artisan optimize        # Includes module:cache
php artisan optimize:clear  # Includes module:clear
```

Installation
------------

[](#installation)

```
composer require sinemacula/laravel-modules
```

### 1. Edit `bootstrap/app.php`

[](#1-edit-bootstrapappphp)

Replace the default Laravel application with the modular variant:

```
