PHPackages                             zonneplan/laravel-module-loader - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. zonneplan/laravel-module-loader

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

zonneplan/laravel-module-loader
===============================

Module loader for Laravel

v7.0.0(2mo ago)24118.4k↑45.3%1[2 PRs](https://github.com/zonneplan/laravel-module-loader/pulls)MITPHPPHP ^8.2

Since Nov 11Pushed 2mo ago8 watchersCompare

[ Source](https://github.com/zonneplan/laravel-module-loader)[ Packagist](https://packagist.org/packages/zonneplan/laravel-module-loader)[ Docs](https://zonneplan.nl)[ RSS](/packages/zonneplan-laravel-module-loader/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (14)Versions (24)Used By (0)

Module loader inside your Laravel app
=====================================

[](#module-loader-inside-your-laravel-app)

[![Latest Version on Packagist](https://camo.githubusercontent.com/72cbb9f0342d4c5d2fcaf95e334f2ba7accb87a30a5b458369e54e95324435dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a6f6e6e65706c616e2f6c61726176656c2d6d6f64756c652d6c6f616465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zonneplan/laravel-module-loader)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/e67b4c38caedea6348ebb7103ab72e2d9da3527884191c7191d841b64cb18ae7/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7a6f6e6e65706c616e2f6c61726176656c2d6d6f64756c652d6c6f616465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/zonneplan/laravel-module-loader)[![Total Downloads](https://camo.githubusercontent.com/2d2435c504fe0182c19a6cf1272b3233c5ad9b73f450c06065d8855b6733bccf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a6f6e6e65706c616e2f6c61726176656c2d6d6f64756c652d6c6f616465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zonneplan/laravel-module-loader)

**Laravel****laravel-module-loader**5.8^1.06.0^1.07.0^1.08.0^2.09.0^3.010.0^4.011.0^5.012.0^6.013.0^7.0The `zonneplan/laravel-module-loader` package provides an easy to use module loader which can be used to modulize your project.

How to use
----------

[](#how-to-use)

First install the package, see the installation section.

#### Creating a new module:

[](#creating-a-new-module)

- Create a folder, for example: `Modules` in the app directory.
- After that create another one, for example: `User`.
- In the root of that folder insert a `UserServiceProvider` which extends our abstract `Module` class.
- Implement the function `getModuleNamespace()` like:

```
namespace Modules\User;

use Zonneplan/ModuleLoader/Module;

class UserServiceProvider extends Module
{
    public function getModuleNamespace(): string
    {
        return 'user';
    }
}
```

- Register the `UserServiceProvider` in the `config/app.php` file.

```
'providers' => [
    Modules\User\UserServiceProvider::class
]
```

#### Structure within the module:

[](#structure-within-the-module)

The expected structure is seen below. Most of it is optional.

```
app
├── Modules
    ├──MyModule
       ├──Config
       ├──Console
       ├──Database
          ├──Factories
          ├──Migrations
       ├──Exceptions
       ├──Http
          ├──Controllers
          ├──Middleware
          ├──Requests
          ├──Resources
       ├──Resources
          ├──lang
          ├──views
       ├──Routes
          ├──web.php
          ├──api.php
          ├──channels.php
          ├──console.php
          ├──mcp.php
       ├──MyModuleServiceProvider.php
       ├──tests

```

#### Access a view from the module:

[](#access-a-view-from-the-module)

To access a view from a module it will look like `'my-module::path.to.view'`

For example:

```
// In a controller
view('user::index');

// In a blade file
@include('user::index');
@include('user::partials.form');
```

#### Registering Policies:

[](#registering-policies)

To register policies overwrite the `$policies` variable in the ServiceProvider of your module

For example:

```
protected $policies = [
    MyModel::class => MyModelPolicy::class,
];
```

#### Registering Middleware:

[](#registering-middleware)

To register middleware overwrite the `$middleware` variable in the ServiceProvider of your module

For example:

```
protected $middleware = [
    'my-middleware' => MyMiddleware::class,
];
```

#### Registering Events &amp; Listeners:

[](#registering-events--listeners)

To register events &amp; listeners overwrite the `$listen` variable in the ServiceProvider of your module

For example:

```
protected $listen = [
    MyEvent::class => [
        MyListener::class
    ],
];
```

#### Registering Event Subscribers:

[](#registering-event-subscribers)

To register event subscribers overwrite the `$subscribe` variable in the ServiceProvider of your module

For example:

```
protected $subscribe = [
    MySubscriber::class
];
```

#### Registering routes:

[](#registering-routes)

All modules will by default try to load all route files in the `Routes` folder. Any of the following files will be auto loaded:

`routes.php` `api.php` `web.php` `mcp.php`

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

[](#requirements)

This package requires at least Laravel 6 or higher, PHP 7.2 or higher

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

[](#installation)

`composer require zonneplan/laravel-module-loader`

The package will automatically register itself.

Register the namespace: `"Modules\\": "app/Modules"` in `composer.json` like:

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

```

Authors
-------

[](#authors)

- **Aron Rotteveel**
- **Dennis Stolmeijer**
- **Wout Hoeve**
- **Johnny Borg**
- **Rick Gout**
- **Thijs Nijholt**

###  Health Score

61

—

FairBetter than 99% of packages

Maintenance88

Actively maintained with recent releases

Popularity41

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 60.9% 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 ~136 days

Recently: every ~182 days

Total

18

Last Release

62d ago

Major Versions

v2.0.2 → v3.0.02022-02-24

v3.0.0 → v4.0.02023-02-16

v4.0.0 → v5.0.02024-03-18

v5.0.0 → v6.0.02025-02-18

v6.0.2 → v7.0.02026-03-18

PHP version history (6 changes)v1.0.0PHP ^7.2

v1.1.0PHP ^7.2.5

v2.0.0PHP ^7.4|^8.0

v3.0.0PHP ^8.0

v4.0.0PHP ^8.1

v5.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f23f96cb2dc977c532c28be6985b0098b2e87b6680caa4a2b59225fd32968d7?d=identicon)[Zonneplan](/maintainers/Zonneplan)

---

Top Contributors

[![rdgout](https://avatars.githubusercontent.com/u/4692202?v=4)](https://github.com/rdgout "rdgout (28 commits)")[![maartenbode](https://avatars.githubusercontent.com/u/1608377?v=4)](https://github.com/maartenbode "maartenbode (7 commits)")[![roy-bongers](https://avatars.githubusercontent.com/u/10220797?v=4)](https://github.com/roy-bongers "roy-bongers (5 commits)")[![MikaDeVries](https://avatars.githubusercontent.com/u/62423481?v=4)](https://github.com/MikaDeVries "MikaDeVries (2 commits)")[![rtuin](https://avatars.githubusercontent.com/u/360150?v=4)](https://github.com/rtuin "rtuin (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![nijholt](https://avatars.githubusercontent.com/u/1433398?v=4)](https://github.com/nijholt "nijholt (1 commits)")[![arondeparon](https://avatars.githubusercontent.com/u/7697?v=4)](https://github.com/arondeparon "arondeparon (1 commits)")

---

Tags

laravelphplaravelloadermodulemoduleszonneplan

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zonneplan-laravel-module-loader/health.svg)

```
[![Health](https://phpackages.com/badges/zonneplan-laravel-module-loader/health.svg)](https://phpackages.com/packages/zonneplan-laravel-module-loader)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[tehwave/laravel-achievements

Simple, elegant Achievements the Laravel way

7012.8k](/packages/tehwave-laravel-achievements)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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