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

ActiveLibrary[Framework](/categories/framework)

bchalier/laravel-modules
========================

Module management in laravel.

2.7.1(4y ago)923.0k↑150%1[4 issues](https://github.com/bchalier/laravel-modules/issues)[1 PRs](https://github.com/bchalier/laravel-modules/pulls)MITPHPPHP ^8.0CI failing

Since Sep 16Pushed 2y ago2 watchersCompare

[ Source](https://github.com/bchalier/laravel-modules)[ Packagist](https://packagist.org/packages/bchalier/laravel-modules)[ RSS](/packages/bchalier-laravel-modules/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (20)Used By (0)

Divide your laravel application in modules, the laravel way
===========================================================

[](#divide-your-laravel-application-in-modules-the-laravel-way)

### Introduction

[](#introduction)

This package is made to allow you to divide everything laravel allow you to make but divided in modules.

I ended up making this package even if other are doing exactly the same thing because after trying to work with them, after some time I always found them incomplete, no longer maintained, not respecting laravel standards and ideas (having module:make-controller command instead of make:controller, another file structure etc) so after trying 3-4 modules I got frustrated and starting making my own package trying to not reproduce the mistakes I saw earlier.

Here are the result, I hove you will like it as much as I do ! This is my first public package so please fell free to send me any suggestions, questions, bug report, feature request you may have !

### Versioning

[](#versioning)

This package follow Semantic Versioning, see :

### Installation

[](#installation)

You can install the package via composer:

```
composer require bchalier/laravel-modules

```

### Commands

[](#commands)

All the standard make commands are extended with a -M|module=\[module alias\] options, here an example :

` php artisan make:model -Muser UnicornModel`

As it is an extend and not a replacement all options are available and working (or should be !)

` php artisan make:model -cfmr -Muser UnicornModel`

The package also add some commands for dealing with the modules themselves :

- `make:module {modules*} {?--fill}` : make one or more new module, use the --fill option to add all possible elements in the newly created module.
- `module:install {modules*}` : install one or more module (in bdd)
- `module:reinstall {modules*}` : reinstall the module (update bdd), useful
- `module:uninstall {modules*}` : uninstall one or more module (keep files, clean bdd)
- `module:enable {modules*}` : load the module (the files will always be loader by composer but the providers, routes etc will only if the module is enabled)
- `module:disable {modules*}` : disable the module
- `module:delete {modules*}` : delete the bdd AND FILES of the module, be careful, this command will delete all your module files and uninstall it.

### Structure

[](#structure)

The insides of a module is pretty much just a normal laravel, here an example (make it yourselves with `php artisan make:module test --fill`) :

```
modules/Test/
├── app
│   ├── Broadcasting
│   │   └── DummyChannel.php
│   ├── Console
│   │   ├── Commands
│   │   │   └── DummyCommand.php
│   │   └── Kernel.php
│   ├── Events
│   │   └── DummyEvent.php
│   ├── Exceptions
│   │   └── DummyException.php
│   ├── Http
│   │   ├── Controllers
│   │   │   └── DummyController.php
│   │   ├── Middleware
│   │   │   └── DummyMiddleware.php
│   │   ├── Requests
│   │   │   └── DummyRequest.php
│   │   └── Resources
│   │       └── DummyResource.php
│   ├── Jobs
│   │   └── DummyJob.php
│   ├── Listener
│   │   └── DummyListener.php
│   ├── Mail
│   │   └── DummyMail.php
│   ├── Models
│   │   └── DummyModel.php
│   ├── Notification
│   │   └── DummyNotification.php
│   ├── Observers
│   │   └── DummyObserver.php
│   ├── Policies
│   │   └── DummyPolicy.php
│   ├── Providers
│   │   └── DummyProvider.php
│   ├── Rules
│   │   └── DummyRule.php
│   └── Services
│       └── DummyService.php
├── composer.json
├── config
│   ├── superconfig.php
├── database
│   ├── factories
│   │   └── DummyFactory.php
│   ├── migrations
│   │   └── 2019_07_04_105604_dummy_migration.php
│   └── seeds
│       ├── DatabaseSeeder.php
│       └── DummySeeder.php
├── resources
│   └── lang
│       ├── en
│       │   └── exceptions.php
│       └── fr
│           └── exceptions.php
├── routes
│   ├── api.php
│   ├── channels.php
│   ├── console.php
│   └── web.php
└── tests
    ├── Feature
    │   └── DummyTest.php
    └── Unit
        └── DummyTest.php

```

### Composer

[](#composer)

At the root of your module you have a composer.json, same as the one you know with just a bit extra, you will find an example bellow.

IT DOES NOT INSTALL PACKAGES, would you want to look into wikimedia/composer-merge-plugin but it's not compatible with composer 2.

```
{
  "name": "Core",
  "description": "A perfect description for a brand new module !",
  "keywords": [
    "module",
    "laravel"
  ],
  "license": "MIT",
  "require": {
    "php": "^7.1"
  },
  "extra": {
    "laravel-modules": {
      "name": "Core",
      "alias": "core",
      "description": "The core module, for module management.",
      "install": {
        "migrate": true,
        "createDir": "modules"
      },
      "loadParameters": {
        "compartmentalize": {
          "migrations": true
        }
      },
      "providers": [
        "SystemModules\\Core\\App\\Providers\\EventServiceProvider",
        "SystemModules\\Core\\App\\Providers\\CommandExtendProvider"
      ],
      "aliases": {
        "Test": "Illuminate\\Support\\Facades\\App",
        "ModulesManager": "SystemModules\\Core\\Services\\ModulesManager"
      }
    }
  }
}

```

Here what that mean :

- **name** : literally whatever you want, simply a cosmetic value.
- **alias** : this is what you will be using in every command.
- **description** : a description, duh.
- **install.migrate** : migrate the migrations on module installation.
- **install.createDir** : create a dir of you liking on installation.
- **loadParameters.compartmentalize.migrations** : isolate the migration from the rest of your app, in this example the migration for the modules table will not be called on any of the `migrate` commands except for the `migrate:fresh` because it drop all tables regardless of migrations, you'll have to install all your modules again after this one.
- **providers** : list all the providers you want to load in your module.
- **aliases** : list all the aliases you want to have in your module.

Remember that you will have to call `php artisan module:reinstall YOUR_MODULE_ALIAS` for updating the settings above.

### .env

[](#env)

Here are some settings added that may be used in your .env :

```
API_PREFIX='web' // a prefix for all the web routes, '' by default
WEB_PREFIX='api' // a prefix for all the api routes, 'api' by default

MODULES_CONFIG_PATH='modules.json' // the location of the global config file (it store the installed modules)

```

That's pretty much it, there probably plenty of room for improvement so I'm waiting your comments on this !

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance11

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 87% 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 ~50 days

Total

16

Last Release

1683d ago

Major Versions

1.2.0 → 2.0.02020-10-31

PHP version history (4 changes)1.1.0PHP &gt;=7.1

2.2.0PHP &gt;=7.1|^8.0

2.3.0PHP ^7.4|^8.0

2.4.0PHP ^8.0

### Community

Maintainers

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

---

Top Contributors

[![bchalier](https://avatars.githubusercontent.com/u/17746418?v=4)](https://github.com/bchalier "bchalier (60 commits)")[![bdelespierre](https://avatars.githubusercontent.com/u/1086339?v=4)](https://github.com/bdelespierre "bdelespierre (9 commits)")

---

Tags

laravelpackagemodulemodulessplitbchalier

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[nwidart/laravel-modules

Laravel Module management

6.1k14.6M274](/packages/nwidart-laravel-modules)[internachi/modular

Modularize your Laravel apps

1.1k662.4k8](/packages/internachi-modular)[pingpong/modules

Laravel Modules

592188.7k13](/packages/pingpong-modules)[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)[artem-schander/l5-modular

Modular pattern generator for Laravel

223235.5k](/packages/artem-schander-l5-modular)

PHPackages © 2026

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