teikun-86/laravel-modular

Laravel Modular Structure

Maintainers

Package info

github.com/teikun-86/laravel-modular-tool

pkg:composer/teikun-86/laravel-modular

Transparency log

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.3 2026-07-17 15:45 UTC

This package is auto-updated.

Last update: 2026-07-17 15:46:04 UTC


README

Laravel Modular is a package that helps you structure your Laravel application into modules. It provides commands to easily create and manage modules, keeping your codebase organized and scalable.

Installation

You can install the package via composer:

composer require teikun-86/laravel-modular

Configuration

You can publish the configuration file using the following artisan command:

php artisan vendor:publish --tag="modular-config"

This will create a config/modular.php file in your application where you can configure the base namespace for your modules:

return [
    /*
     |------------------------------------------------------------
     | Namespace Configuration
     |------------------------------------------------------------
     | Base namespace for all generated modules.
     | Can be overridden by environment variable or module config.
     | Should usually match your application's root namespace.
     | Default: 'LaravelApp'
     | Example: 'LaravelApp', 'MyProject'
     | Example output: namespace LaravelApp\Modules\User\Models;
     |------------------------------------------------------------
     */
    'namespace' => env('MODULAR_NAMESPACE', 'LaravelApp'),
];

Usage

Creating a Module

To create a new module, you can use the make:module artisan command:

php artisan make:module {name}

You can optionally pass a --namespace option:

php artisan make:module {name} --namespace="CustomNamespace"

This command will automatically:

  1. Create a new directory for your module under the application's modules/ path.
  2. Set up the basic src/ directory.
  3. Generate a ServiceProvider for the module.
  4. Add the ServiceProvider to your application's bootstrap providers file.
  5. Update your composer.json to include the new module's PSR-4 autoloading rules and run composer dump-autoload.

Creating Module Classes

You can also create specific classes inside your modules (like ServiceProviders, Controllers, etc.) using the make:module-class command.

php artisan make:module-class --module={name} --type={type} {class_name}

License

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