sertsoft/module-generator

Generate scaffold for Laravel >= 11.0

Maintainers

Package info

github.com/Matheusouza2/laravel-module-generator

pkg:composer/sertsoft/module-generator

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.0.1 2026-03-20 22:32 UTC

This package is auto-updated.

Last update: 2026-03-20 22:37:57 UTC


README

Packagist Version Laravel PHP License Downloads

Laravel Module Generator

A powerful scaffolding package for Laravel 11+ that accelerates development by generating a complete modular structure following clean architecture principles.

This package allows you to create Models, Controllers, DTOs, Services, Repositories, and more — all with a single command.

⚠️ Requirements

PHP 8.1+

Laravel 11+

🚀 Features

  • Generate full modules with one command
  • Clean Architecture structure (DTO, Service, Repository)
  • Automatic Repository ↔ Interface binding
  • Customizable stubs
  • Plug-and-play installation
  • Laravel 11+ support

💡 Best Practices

Use Service layer for business logic

Keep Controllers thin

Use DTOs for data transfer

Use Repositories for data abstraction

📦 Installation

Require the package via Composer:

composer require sertsoft/module-generator

⚙️ Setup

Run the installation command:

php artisan module:install

This will:

Create App\Providers\RepositoryServiceProvider

Register the provider in bootstrap/providers.php

Publish configuration and stubs (if configured)

🧱 Usage

Create a Full Module

php artisan make:module User

This command will generate:

app/Models/User.php
app/Http/Controllers/UserController.php
app/Http/Resources/UserResource.php
app/DTO/UserDTO.php
app/Services/UserService.php
app/Repositories/User/UserRepository.php
app/Repositories/User/UserRepositoryInterface.php

And automatically bind:

UserRepositoryInterface::class => UserRepository::class

Inside

App\Providers\RepositoryServiceProvider

🧩 Available Commands

Command Description
make:module {name} Create full module
make:dto {name} Create DTO
make:service {name} Create Service
make:repository {name} Create Repository + Interface
module:install Setup provider and configuration

⚙️ Configuration

Publish the config file:

php artisan vendor:publish --tag=module-generator-config

Example configuration:

return [

    'namespace' => 'App',

    'paths' => [
        'dto' => app_path('DTO'),
        'service' => app_path('Services'),
        'repository' => app_path('Repositories'),
    ],

    'namespaces' => [
        'dto' => 'App\\DTO',
        'service' => 'App\\Services',
        'repository' => 'App\\Repositories',
    ],

    'stubs_path' => base_path('stubs/module-generator'),

    'auto_bind_repository' => true,
];

🧾 Stubs Customization

Publish stubs:

php artisan vendor:publish --tag=module-generator-stubs

Then edit

stubs/module-generator/

You can fully customize:

  • DTO structure

  • Service layer

  • Repository pattern

  • Naming conventions

🔗 Repository Binding

The package automatically registers bindings like:

$this->app->bind(
    UserRepositoryInterface::class,
    UserRepository::class
);

No manual configuration needed.

🛠 Roadmap

  • Auto CRUD generation

  • Request validation generation

  • Policy generation

  • Test scaffolding

  • Inertia / API mode support

🤝 Contributing

Pull requests are welcome!