Увійти Реєстрація
Вакансії
Вакансії Laravel Компанії Статистика
Підготовка
Як підготуватися Співбесіди Тестування Документація
Блог
Всі статті Серії
Екосистема
Пакети Ресурси Проєкти Інструменти Події Відео
Інше
Про нас Реклама

Laravel Modules

nwidart/laravel-modules
v13.6.0 6,239 20.5M 26 листопада 2026
На GitHub

Пакет для управління модулями у Laravel, що дозволяє організовувати код у самостійні, модульні компоненти зі своєю структурою.

26

Поділитись

README

Laravel Modules: one app, many self-contained modules

Latest Version on Packagist Software License Tests Total Downloads

What it does

  • Splits a large Laravel app into modules that live in Modules/.
  • Each module is a self-contained unit with its own service providers, routes, controllers, models, views, migrations, config and translations. It works like a small Laravel package inside your app.
  • Modules can be enabled or disabled. Only enabled modules are booted. Status is stored by an activator (a JSON file by default).
  • Artisan generators create modules and the classes inside them: module:make, module:make-controller, module:make-model, module:make-migration, and more.

php artisan module:make Blog generates:

Modules/Blog/
├── app/            Http/Controllers, Providers
├── config/
├── database/       factories, migrations, seeders
├── resources/      assets, views
├── routes/         web.php, api.php
├── tests/          Feature, Unit
├── composer.json
├── module.json
├── package.json
└── vite.config.js

Requirements

PHP 8.3+ and Laravel 13 for the current version. See Versions for older Laravel releases.

Install

composer require nwidart/laravel-modules

The service provider and alias are registered automatically. To publish the config file (optional):

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

Autoloading

Module classes are autoloaded through wikimedia/composer-merge-plugin. Add this to the extra section of your app's composer.json:

"extra": {
    "laravel": {
        "dont-discover": []
    },
    "merge-plugin": {
        "include": [
            "Modules/*/composer.json"
        ]
    }
},

On first install, Composer asks:

Do you trust "wikimedia/composer-merge-plugin" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) [y,n,d,?]

Answer y. Or add it yourself:

"config": {
    "allow-plugins": {
        "wikimedia/composer-merge-plugin": true
    }
}

If the plugin is set to false, modules are not autoloaded. After changing composer.json, run:

composer dump-autoload

Since v11.0, the "Modules\\": "Modules/" autoload entry is no longer needed. Remove it from your composer.json if present.

Quick start

php artisan module:make Blog      # create a module
php artisan module:list           # list modules and their status
php artisan module:disable Blog   # stop booting the module
php artisan module:enable Blog    # boot it again

Versions

Laravel laravel-modules
13 ^13.0
12 ^12.0
11 ^11.0
10 ^10.0

Older Laravel versions use the matching major: 5.4 uses ^1.0, 5.5 uses ^2.0, through Laravel 9 with ^9.0.

Documentation

Full documentation: https://nwidart.github.io/laravel-modules/.

Related tools

  • Mortise is a desktop app and a command line tool that show the modules of an app and check the boundaries between them.

Credits

Originally based on pingpong/modules, which is no longer maintained.

License

MIT. See LICENSE.md.

Коментарі

Увійдіть, щоб залишити коментар

Будьте першим, хто залишить коментар!

Схожі пакети

Tenancy

archtechx/tenancy

Автоматична багатотенантність для вашої Laravel-програми.

4,432 v3.10.1 13 21

Laravel Actions

lorisleiva/laravel-actions

Laravel-компоненти, які виконують одну специфічну задачу, забезпечуючи чистоту архітектури та організацію коду на основі принципу Single Responsibility.

2,873 2.13.0 13 13

Laravel Enum

bensampo/laravel-enum

Простий, розширюваний і потужний реалізація перерахування для Laravel.

2,026 v6.14.1 13 27

Laravel Multitenancy

spatie/laravel-multitenancy

Перетворіть вашу Laravel-програму на мультитенантну архітектуру, що дозволяє обслуговувати кількох користувачів (тенантів) в одному застосунку.

1,375 4.3.2 13 20

Modular

internachi/modular

Пакет для модуляризації Laravel додатків, дозволяє організувати код в окремі модулі для кращої структури та підтримки проекту.

1,213 3.0.2 14 18

Laravel Brain

laramint/laravel-brain

Візуалізуй життєцикл запиту Laravel у вигляді інтерактивного графіка.

940 v2.7.1 13 16