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
Requires
- php: ^8.1
- illuminate/support: ^10.0|^11.0|^12.0
README
Easily manage modular routes in Laravel projects โ automatically create, load, and organize module routes and controllers in a professional, production-ready way.
๐ 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 routesmodule:listโ List all modulesmodule: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
- Run
php artisan make:module Customer - Add business logic to
CustomerController - Routes are automatically available under
/api/customer - Add more modules similarly without touching core routes
๐ค Contributing
Contributions are welcome!
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Commit your changes:
git commit -m "Add new feature" - Push to your fork:
git push origin feature/new-feature - 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.