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

ActiveLibrary[Framework](/categories/framework)

mozex/laravel-modules
=====================

Module Management For Laravel

3.0.3(2mo ago)315.8k↓30.6%1MITPHPPHP ^8.3.0CI passing

Since Oct 15Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/mozex/laravel-modules)[ Packagist](https://packagist.org/packages/mozex/laravel-modules)[ Docs](https://github.com/mozex/laravel-modules)[ GitHub Sponsors](https://github.com/mozex)[ RSS](/packages/mozex-laravel-modules/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (30)Versions (40)Used By (0)

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

[](#laravel-modules)

[![Latest Version on Packagist](https://camo.githubusercontent.com/60ce30a63ba0ed02537c3315699ba72889f9c578f0a2ea0abfa6182c504cae05/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f7a65782f6c61726176656c2d6d6f64756c65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mozex/laravel-modules)[![GitHub Tests Workflow Status](https://camo.githubusercontent.com/b5a478a7900cfbc65acd9fa3b28f53dac698b1a5d810cd31e892df03ce4024e0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f7a65782f6c61726176656c2d6d6f64756c65732f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mozex/laravel-modules/actions/workflows/tests.yml)[![License](https://camo.githubusercontent.com/44e66c990cca041113831b557de52d39b94718dba81e90b3ffdb813a5d0fded5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6f7a65782f6c61726176656c2d6d6f64756c65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mozex/laravel-modules)[![Total Downloads](https://camo.githubusercontent.com/382296bb79ee03919bbc2847f37c7acfce3ba18c20c25ca7d5200995a4df47dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f7a65782f6c61726176656c2d6d6f64756c65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mozex/laravel-modules)

Laravel Modules brings a clean, zero‑config modular structure to your Laravel app. Place your modules under the project root `Modules/` directory and this package will auto‑discover and wire their assets: configs, service providers, helpers, artisan commands, migrations, translations, views, Blade components, routes (web/api/console/broadcasting), schedules, listeners/events, Livewire, Filament, Nova, and more.

> Sensible conventions: namespaces, view/component aliases, and route groups are derived automatically.
>
> Fine‑grained control: enable/disable modules, control load order, and override discovery patterns from `config/modules.php`.
>
> Fast by default: built‑in caching makes discovery quick in all environments.

- [Support This Project](#support-this-project)
- [Documentation](#documentation)
- [Requirements](#requirements)
- [Installation](#installation)
- [Quick start](#quick-start)
- [Configuration overview](#configuration-overview)
- [Features](#features)
- [Caching](#caching)
- [Testing](#testing)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [Security Vulnerabilities](#security-vulnerabilities)
- [Credits](#credits)
- [License](#license)

Support This Project
--------------------

[](#support-this-project)

I maintain this package along with [several other open-source PHP packages](https://github.com/mozex?tab=repositories&q=&type=source) used by thousands of developers every day.

If my packages save you time or help your business, consider [**sponsoring my work on GitHub Sponsors**](https://github.com/sponsors/mozex). Your support lets me keep these packages updated, respond to issues quickly, and ship new features.

Business sponsors get logo placement in package READMEs. [**See sponsorship tiers →**](https://github.com/sponsors/mozex)

Documentation
-------------

[](#documentation)

Detailed documentation, including examples and best practices, lives in the `docs` directory.

### Index

[](#index)

- Start here: [docs/README.md](./docs/README.md)

### Feature guides

[](#feature-guides)

- [Blade Components: class-based components](./docs/features/blade-components.md)
- [Views: namespacing and anonymous components](./docs/features/views.md)
- [Routes: groups, broadcasting, console routes](./docs/features/routes.md)
- [Configs: merge strategy and priority](./docs/features/configs.md)
- [Migrations](./docs/features/migrations.md)
- [Seeders](./docs/features/seeders.md)
- [Commands](./docs/features/commands.md)
- [Helpers](./docs/features/helpers.md)
- [Models &amp; Factories](./docs/features/models-factories.md)
- [Policies](./docs/features/policies.md)
- [Events &amp; Listeners](./docs/features/events-listeners.md)
- [Schedules](./docs/features/schedules.md)
- [Livewire Components](./docs/features/livewire-components.md)
- [Filament Resources/Pages/Widgets/Clusters](./docs/features/filament.md)
- [Nova Resources](./docs/features/nova-resources.md)

Requirements
------------

[](#requirements)

- PHP: ^8.3
- Laravel: ^11.29 | ^12.0 | ^13.0
- Livewire: ^4.0 (optional)
- Filament: ^5.0 (optional)

> **Need older versions?** If your application uses PHP 8.2, Laravel 10, Livewire v3, or Filament v3/v4, use the [2.x branch](https://github.com/mozex/laravel-modules/tree/2.x) instead.

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

[](#installation)

Install via Composer:

```
composer require mozex/laravel-modules
```

Register the `Modules` namespace in your project's `composer.json` so PHP can autoload module classes:

```
{
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            "Modules\\": "Modules/"
        }
    }
}
```

Then regenerate the autoloader:

```
composer dump-autoload
```

> If you use a custom `modules_directory` or `modules_namespace` in the config, adjust the path and namespace above accordingly.

Publish the config file (optional, only if you want to tweak defaults):

```
php artisan vendor:publish --tag=laravel-modules-config
```

This will publish `config/modules.php`.

Quick start
-----------

[](#quick-start)

By default, modules live under the project root `Modules/` directory. Each module contains a conventional structure, for example:

```
project-root/
├── app/
├── bootstrap/
├── config/
├── database/
├── Modules/
│   ├── Blog/
│   │   ├── Config/
│   │   ├── Console/
│   │   ├── Database/
│   │   │   ├── Factories/
│   │   │   ├── Migrations/
│   │   │   └── Seeders/
│   │   ├── Filament/
│   │   ├── Lang/
│   │   ├── Listeners/
│   │   ├── Models/
│   │   ├── Policies/
│   │   ├── Providers/
│   │   ├── Resources/
│   │   │   └── views/
│   │   ├── Routes/
│   │   └── View/
│   │       └── Components/
│   └── Shop/
│       └── ...
└── vendor/

```

Out of the box, the package will automatically discover and register the following assets inside your modules: configs, service providers, helpers, artisan commands, migrations, translations, views, Blade components, models, factories, policies, routes, schedules, listeners/events, Livewire, Filament, and Nova resources.

Use your assets via namespaced conventions:

- Views: `view('blog::post.show')` maps to `Modules/Blog/Resources/views/post/show.blade.php`
- Class-based Blade components: `` for `Modules/Blog/View/Components/Post/Card.php`
- Anonymous Blade components (from views): `` for `Modules/Blog/Resources/views/components/button/primary.blade.php`
- Routes: drop files under `Modules/*/Routes/*.php` and they will be loaded under sensible groups (web, api). See the Routes feature docs for customization.

Note for contributors: the test workbench lives in `workbench/` and follows the same conventions (`workbench/Modules/*`).

Configuration overview
----------------------

[](#configuration-overview)

All options live in `config/modules.php`.

- modules\_directory: default `Modules` (relative to the project base path). Change where your modules are stored.
- modules\_namespace: default `Modules\\`. Change the PSR-4 base namespace for your modules.
- modules: per-module activation and ordering. Example: ```
    'modules' => [
        'Shared' => [
            'active' => true,
            'order' => 1, // lower loads earlier
        ],
    ],
    ```
- Per-asset sections: each feature can be enabled/disabled and configured with glob patterns and other options. For example, Blade Components: ```
    'blade-components' => [
        'active' => true,
        'patterns' => [
            '*/View/Components',
        ],
    ],
    ```
- Configs merging priority: when `'configs.priority' => true`, values from your modules override the app config; when false, app config wins and modules provide defaults.

You can disable any feature by setting `'active' => false` in its section.

### Modules Facade

[](#modules-facade)

The `Mozex\Modules\Facades\Modules` facade provides utility methods:

```
use Mozex\Modules\Facades\Modules;

Modules::basePath('path');                    // Get base path with suffix
Modules::modulesPath('Blog/Config');          // Get modules directory path
Modules::moduleNameFromNamespace($class);     // Extract module name from namespace
Modules::moduleNameFromPath($path);           // Extract module name from file path
Modules::seeders();                           // Get all module seeder classes
Modules::routeGroup('admin', ...);            // Define custom route group
Modules::registerRoutesUsing('name', fn);     // Custom route registration
```

See [docs/README.md](./docs/README.md) for the complete API reference.

Features
--------

[](#features)

This package discovers and wires many module assets. We’ll document them in depth, one by one. Suggested reading order:

1. Blade Components (class-based)
2. Views (namespaces, anonymous components)
3. Routes (groups, api/web, broadcasting, commands)
4. Configs (merging strategy, priority)
5. Migrations
6. Seeders
7. Commands
8. Helpers
9. Models &amp; Factories
10. Policies
11. Events &amp; Listeners
12. Schedules
13. Livewire Components
14. Filament (Resources, Pages, Widgets, Clusters)
15. Nova Resources

Caching
-------

[](#caching)

This package supports a single discovery cache that speeds up scanning your Modules directory. Use these commands:

- Build the discovery cache: ```
    php artisan modules:cache
    ```
- Clear the discovery cache: ```
    php artisan modules:clear
    ```

Tip: after adding, renaming, or moving module assets, clear any relevant Laravel caches and rebuild the modules discovery cache as needed.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Mozex](https://github.com/mozex)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance89

Actively maintained with recent releases

Popularity31

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 90.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~24 days

Recently: every ~4 days

Total

38

Last Release

61d ago

Major Versions

1.3.0 → 2.0.02024-02-28

2.8.0 → 3.0.02026-02-25

2.8.1 → 3.0.12026-02-26

2.8.2 → 3.0.22026-03-08

PHP version history (4 changes)1.0.0PHP ^8.1

2.6.0PHP ^8.1.0

2.8.0PHP ^8.2.0

3.0.0PHP ^8.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f4d33a9cb8263eab6fa251e57fc763c5c6977701e5cafa0edc538c4651bb9780?d=identicon)[mozex](/maintainers/mozex)

---

Top Contributors

[![mozex](https://avatars.githubusercontent.com/u/18025667?v=4)](https://github.com/mozex "mozex (278 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (17 commits)")[![claude](https://avatars.githubusercontent.com/u/81847?v=4)](https://github.com/claude "claude (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")

---

Tags

auto-discoveryddddomain-driven-designfilamenthmvclaravellivewiremodular-architecturemodulesphplaravellaravel-modulesmozex

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/mozex-laravel-modules/health.svg)

```
[![Health](https://phpackages.com/badges/mozex-laravel-modules/health.svg)](https://phpackages.com/packages/mozex-laravel-modules)
```

###  Alternatives

[mhmiton/laravel-modules-livewire

Using Laravel Livewire in Laravel Modules package with automatically registered livewire components for every modules.

236409.6k9](/packages/mhmiton-laravel-modules-livewire)[codewithdennis/larament

Larament is a time-saving starter kit to quickly launch Laravel 13.x projects. It includes FilamentPHP 5.x pre-installed and configured, along with additional tools and features to streamline your development workflow.

3691.5k](/packages/codewithdennis-larament)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
