On this page

Installation and Setup


To install through composer, by run the following command:

composer require nwidart/laravel-modules

Add Service Provider

Next add the following service provider in config/app.php.

'providers' => [

Next, add the following aliases to aliases array in the same file.

'aliases' => [
  'Module' => Nwidart\Modules\Facades\Module::class,

Next publish the package's configuration file by running :

php artisan vendor:publish --provider="Nwidart\Modules\LaravelModulesServiceProvider"


By default the module classes are not loaded automatically. You can autoload your modules using psr-4. For example :

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

Tip: don't forget to run composer dump-autoload afterwards

Laravel Package built by Nicolas Widart.
Maintained by David Carr follow on X @dcblogdev