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

AbandonedArchivedLibrary[Framework](/categories/framework)

neilherbertuk/laravel-modules
=============================

Modules Provider for Laravel 5

394PHP

Since Jan 11Pushed 7y ago2 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#laravel-modules)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/47e0fee821169036a3f432aac2155ec171ed98f7ed03365309073436fde2df11/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e65696c68657262657274756b2f6d6f64756c65732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/neilherbertuk/modules/?branch=master) [![Build Status](https://camo.githubusercontent.com/3adf972cec1857d0ec62db1f754b01adb3159d260a53cd82acbaafd48a06bdc8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e65696c68657262657274756b2f6d6f64756c65732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/neilherbertuk/modules/build-status/master)

A package to add modules to a [Laravel](https://laravel.com/) 5 application. This package allows you to separate out code for parts of your application into their own dedicated "modules" or folders, allowing all code related to a specific section or function of your application to be stored in one place.

Compatible with:

- Laravel 5.4
- Laravel 5.5

Currently supports:

- Controllers
- Migrations
- Models
- Routes, web and api
- Service Providers
- Views
- Console Commands

Currently not supported:

- Database Seeding
- Module Middleware

This package will soon have commands to assist in making each of these.

Example
-------

[](#example)

An admin panel at *domain.com/admin* - all functionality related to the admin panel could be turned into a module and stored together in a single location.

Example Structure

```
Admin
 - Admin/controllers
 - - Admin/controllers/AdminController.php
 - Admin/database
 - - Admin/database/migrations
 - - - Admin/database/migrations/Create_A_Table_Migrtion.php
 - Admin/models
 - - Admin/models/statistics.php
 - Admin/views
 - - Admin/views/dashboard.blade.php
 - Admin/web.php

```

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

[](#installation)

This version has been tested with Laravel 5.4 and 5.5, other versions will be tested in the future.

```
$ composer require neilherbertuk/laravel-modules:dev-master
```

### Laravel 5.4

[](#laravel-54)

If you are using Laravel 5.4, you will need to register the service provider in your `config/app.php`

```
        neilherbertuk\modules\ModuleServiceProvider::class,
```

### Laravel 5.5

[](#laravel-55)

If you are using Laravel 5.5 or up, Automatic Package Discovery should autoload the `ModuleServiceProvider`, if this does not happen run the following commands from the root of your laravel project:

```
$ composer dump-autoload
$ php artisan package:discover
```

### Configuration

[](#configuration)

If you would like to make changes to the default configuration, publish the package's config file.

```
$ php artisan vendor:publish --provider="neilherbertuk\modules\ModuleServiceProvider" --tag=config
```

This will create a `config/modules.php` file in your app that you can modify to set your configuration.

The package can be configured to work in several ways. By default the package will autoload modules under the `app\Modules` folder.

In my opinion (correct me if I am wrong) auto-loading is great in development, but not recommended in production due to the expensive nature of finding each available module.

#### Enable Autoload

[](#enable-autoload)

This is the default behaviour, but can be added to your `.env` file

```
MODULES_AUTOLOAD=true
```

#### Disable Autoload

[](#disable-autoload)

Add the following to your `.env` file

```
MODULES_AUTOLOAD=false
```

#### Manually Loading Modules

[](#manually-loading-modules)

Manual loading of modules will occur when Autoload is disabled. Within your `config/modules.php` file you will find a blank `enabled` array. Simply add the name of each module you wish to manually load as a new entry. Each name is the name of the folder your module sits in.

```
'enabled' => [
                'Admin',
                'Forum'
            ],
```

#### Disabling Modules

[](#disabling-modules)

When using Autoloading, it is possible to disable certain modules. Within your `config/modules.php` file is a blank `disabled` array. Any modules listed here will not be loaded.

```
'disabled' => [
                'Admin'
            ],
```

### Usage

[](#usage)

To be completed.

The Laravel-Modules package comes with a handy console command to help build new modules. It's usage can be seen by running the following command:

```
    $ php artisan make:module
```

#### Creating a New Module

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

To create a new module, run the following command from the root of your Laravel project

```
    $ php artisan make:module --create ModuleName [--webroute | --apiroute]
```

This will create a new folder structure as shown in the example above within your `app/Module` folder.

##### New Module Routes

[](#new-module-routes)

Unless an option is given, by default, the create command will also create a web routes file (`web.php`). The routes file generated by this will include a group prefix to help separate your module from other parts of your application.

If you would prefer to create an api route file (`api.php`) add `--apiroute` to the command.

```
    $ php artisan make:module --create ModuleName --apiroute
```

If you would like to add both a web and api routes file, add both `--webroute` and `--apiroute` to the create command, alternatively you can use these options without `--create` if the module has already been created.

```
    $ php artisan make:module --create ModuleName --apiroute --webroute
```

The module name will automatically be converted to lower case and used as a prefix for any routes file created. If you create a new module named "Dashboard", anything within the module will be available at *domain.com/dashboard/*

##### New Module Controller

[](#new-module-controller)

You can create a new module controller using the --controller option, optionally you can also include --resource

```
    $ php artisan make:module ModuleName --controller NameOfController [--resource]
```

This will place a new controller into your `app\Modules\ModuleName\Controllers` folder. By default this will create a plain controller. If you would like to create a resource controller add --resource which will include all of the basic CRUD methods for you.

##### Module Namespacing

[](#module-namespacing)

All files related to the module must belong to the same namespace. This is done automatically for you if you use the provided console commands.

```
namespace app\Modules\ModuleName\Controllers;
namespace app\Modules\ModuleName\Models;
namespace app\Modules\ModuleName\Migrations;

```

### TODO

[](#todo)

- Working On - Complete Documentation - Usage Section
- Working On - Create commands to easily make modules and various parts such as controllers and views within a module.
- Working On - Create example project
- Working On - Test support for other versions of Laravel 5
- Create Unit Tests

Bugs
----

[](#bugs)

Please report any bugs by opening an issue on [github](https://github.com/neilherbertuk/modules/issues).

Security Issues
---------------

[](#security-issues)

Please email any security issues directly to .

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4aa64a1d968b51867982bbeee54ff66de1325d6c093018f17d33d6eede5d482c?d=identicon)[neilherbertuk](/maintainers/neilherbertuk)

---

Top Contributors

[![neilherbertuk](https://avatars.githubusercontent.com/u/5868029?v=4)](https://github.com/neilherbertuk "neilherbertuk (1 commits)")

---

Tags

laravellaravel-5-packagelaravel-modules

### Embed Badge

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

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

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M190](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M255](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M591](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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