victormgomes/laravel-modules-plus

Enhancements for the nWidart/laravel-modules package

Maintainers

Package info

github.com/VictorMGomes/laravel-modules-plus

Homepage

Issues

pkg:composer/victormgomes/laravel-modules-plus

Fund package maintenance!

VictorMGomes

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 1

0.0.7 2026-04-28 07:52 UTC

This package is auto-updated.

Last update: 2026-04-28 08:00:22 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads License

Enhancements for the nWidart/laravel-modules package

Introduction

Laravel Modules Plus is a powerful, zero-configuration addon designed to transform your modules into truly self-contained, portable packages. It automates the "heavy lifting" of resource registration and provides robust environment-level control, ensuring your modular architecture is enterprise-ready.

Why use this package?

  • Zero-Config Discovery: Automatically discovers and registers routes, policies, observers, and events based on simple folder conventions.
  • Environment Control: Manage module activation via .env (APP_MODULES_ENABLED), eliminating the need to track modules_statuses.json in version control.
  • Multi-Tenancy Ready: Intelligent separation of Central and Tenant migrations for complex application architectures.
  • Portability: Optimized stubs ensure that every new module follows a consistent, decoupled structure from day one.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by sponsoring us on GitHub.

Installation

  1. Install the package via composer:
composer require victormgomes/laravel-modules-plus
  1. (Optional) Publish the configuration and stubs:
php artisan modules-plus:install
  1. Update your config/modules.php to use the new Activator:
'activator' => 'env',
'activators' => [
    'env' => [
        'class' => \Victormgomes\ModulesPlus\Activators\EnvActivator::class,
    ],
],

Usage

1. Activating Modules

Modules are managed via your .env file. Only modules listed here will be booted:

APP_MODULES_ENABLED=Auth,User,Chat,Billing

2. Creating New Modules

The generated Service Provider will extend AbstractModuleServiceProvider. This parent class handles all registration automatically as long as you follow the standard folder structure:

  • Routes/api.php, Routes/web.php -> Loaded automatically.
  • Policies/ -> UserPolicy automatically linked to Models/User.
  • Observers/ -> UserObserver automatically linked to Models/User.
  • Database/Migrations/Tenant -> Automatically loaded only for tenant database contexts.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.