sagar-s-bhedodkar/laravel-modular-routes

Easily manage modular routes in Laravel projects โ€” automatically generate, organize, and load module routes and controllers. Keep your application clean, scalable, and production-ready with minimal setup. Each module can have its own routes, controllers, views, and tests, making large applications e

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/sagar-s-bhedodkar/laravel-modular-routes

v1.0.1 2025-10-15 17:06 UTC

This package is auto-updated.

Last update: 2025-11-18 18:00:50 UTC


README

Easily manage modular routes in Laravel projects โ€” automatically create, load, and organize module routes and controllers in a professional, production-ready way.

License: MIT Laravel Packagist GitHub stars

๐Ÿ“˜ Table of Contents

๐Ÿš€ Introduction

Laravel Modular Routes is a lightweight package for modular route management. It allows developers to automatically create modules with controllers and route files and load them dynamically, keeping your application organized and production-ready.

Create a module in seconds:

php artisan make:module Customer

The routes and controllers are automatically generated and ready for use.

โœจ Features

  • ๐Ÿงฉ Automatic module scaffolding

  • ๐Ÿ“‚ Supports API and Web routes per module

  • ๐Ÿ”„ Dynamic autoloading of module classes (no composer.json edits required)

  • โš™๏ธ Artisan commands for module management:

    • make:module โ€” Create a new module with CRUD routes
    • module:list โ€” List all modules
    • module:clear-cache โ€” Clear module cache
  • ๐Ÿงน Clean folder structure (Modules/ModuleName/)

  • โœ… Production-ready, scalable approach for large applications

โš™๏ธ Installation

Require the package via Composer:

composer require sagar-s-bhedodkar/laravel-modular-routes:@dev

The package auto-discovers itself; no manual registration is required.

๐Ÿง  Usage

โž• Create a module

php artisan make:module Customer

This generates:

Modules/
 โ””โ”€โ”€ Customer/
     โ”œโ”€โ”€ Routes/api.php
     โ””โ”€โ”€ Http/Controllers/CustomerController.php

๐Ÿ“ Access routes

For example, if your module is Customer:

  • GET /api/customer โ†’ List all customers
  • POST /api/customer โ†’ Create a new customer
  • GET /api/customer/{id} โ†’ Show customer
  • PUT /api/customer/{id} โ†’ Update customer
  • DELETE /api/customer/{id} โ†’ Delete customer

๐Ÿ”„ List modules

php artisan module:list

๐Ÿงน Clear module cache

php artisan module:clear-cache

๐Ÿงฉ Example Workflow

  1. Run php artisan make:module Customer
  2. Add business logic to CustomerController
  3. Routes are automatically available under /api/customer
  4. Add more modules similarly without touching core routes

๐Ÿค Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/new-feature
  3. Commit your changes: git commit -m "Add new feature"
  4. Push to your fork: git push origin feature/new-feature
  5. Submit a Pull Request ๐ŸŽ‰

๐Ÿ“„ License

This package is open-sourced software licensed under the MIT license.

๐Ÿ‘จโ€๐Ÿ’ป Author

Sagar Sunil Bhedodkar ๐Ÿ“ง sagarbhedodkar456@gmail.com ๐ŸŒ GitHub Profile

Made with โค๏ธ for Laravel developers who value modularity, automation, and production-ready code.