Laravel Module Generator

v 1.3.*

🚀 Installation

Install the package via Composer:

composer require nahid-ferdous/laravel-module-generator --dev

📦 Service Provider

Generate required files and configurations:

php artisan module-generator:install

# or force install if you already have executed the command before

php artisan module-generator:install --force

What Gets Generated

The installation command creates the following files and configurations:

Core Files

  • Useful Traitsapp/Traits/*
  • Global Exception Handlerapp/Exceptions/ExceptionHandler.php
  • Useful Helper Functionsapp/Helpers/*

Middleware

  • Cors Middlewareapp/Http/Middleware/Cors.php
    • Handles Cross-Origin Resource Sharing (CORS) requests
  • Auth Middlewareapp/Http/Middleware/Authenticate.php
    • Required to prevent "login route not defined" error when accessing protected routes without token

Configuration

  • Dummy modules.yaml Filemodule/modules.yaml