Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon NWidart/laravel-modules
    Laravel Service Provider


NWidart/laravel-modules


The `nwidart/laravel-modules` package is designed to help manage large Laravel applications by organizing them into smaller, reusable, and modular components. This package is similar to a Laravel package but includes additional features such as views, controllers, models, and tests. It is supported and tested in Laravel 5 and is used in AsgardCMS.

Key Features:

1. Modular Structure: The package provides a structured way to organize your Laravel application into smaller modules, enhancing code organization and maintainability[1][2].
2. Views, Controllers, and Models: Each module includes views, controllers, and models, making it a self-contained unit of functionality[1][2].
3. Tests: The package includes tests, which is a significant addition compared to the original package[1][2].
4. Compatibility: It is compatible with Laravel 5 and supports migration to version 6 with the command `php artisan module:v6:migrate`[2].

Usage:

1. Generating a Module: Use the command `php artisan module:make Blog` to generate a new module named "Blog" with the following structure:


app/
bootstrap/
vendor/
Modules/
Blog/
Assets/
Config/
Console/
Database/
Migrations/
Seeders/
Entities/
Http/
Controllers/
Middleware/
Requests/
Providers/
BlogServiceProvider.php
Resources/
lang/
views/
Repositories/
Tests/
composer.json
module.json
start.php

2. Upgrading to v6: If you are upgrading from a previous version, run `php artisan module:v6:migrate` to migrate your modules to version 6[2].

Additional Resources:

- Documentation: The official documentation provides detailed information on how to use the package and its features[1][2].
- GitHub Repository: The package is available on GitHub, where you can find the source code and contribute to its development[4].
- Laravel Modules Website: The official website provides an overview of the package and its benefits[3].

Conclusion:

The `nwidart/laravel-modules` package is a powerful tool for managing large Laravel applications by breaking them down into smaller, reusable modules. Its features, such as views, controllers, models, and tests, make it a comprehensive solution for organizing and maintaining complex applications.
Citations:
[1] https://nwidart.com/laravel-modules/v1/introduction
[2] https://nwidart.com/laravel-modules/v6/introduction
[3] https://laravelmodules.com
[4] https://github.com/nWidart/laravel-modules/actions/runs/9539720431/job/26290392108