vaened / laravel-route-moduler
Installs: 8 810
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.2
- laravel/framework: ^10|^11
- vaened/support: ^4.0
Requires (Dev)
- orchestra/testbench: ^8|^9
- phpunit/phpunit: ^10
README
Separate laravel routes by modules and submodules
└── routes └── api └── clients.php └── payments.php └── store.php
Installation
Laravel Route Moduler requires PHP 8.2. To get the latest version, simply require the project using Composer:
composer require vaened/laravel-route-moduler
Now. Publish the configuration file.
php artisan vendor:publish --tag='laravel-route-moduler'
Usage
Once the library is installed, you can start organizing your routes within the /routes/modules folder, which is the default location. If you prefer a different location, you can update it in the route-modules.php configuration file.
├── routes └── modules
Multiple Modules
The route-modules.php configuration file returns an array for a single module setup. However, you can configure as many modules as you need by extending this array.
└── routes └── api └── web └── app
This structure helps to keep your application’s routes organized, making maintenance and scalability easier.
Configuration
You can customize the behavior of the laravel-route-moduler
package through the route-modules.php configuration file. Below are the available options:
• path: Specifies where the route configuration files for the module are located. You can set this to a directory or a single file.
Example:
Load all routes in a directory: 'path' => 'routes/modules'
Single route file: 'path' => 'routes/users.php'
• prefix: Adds a prefix to the module path when the module is created, helping to make modules independent and supplement filename prefixes.
Example:
'prefix' => 'admin'
• named: If true, the route file name will be used as a prefix for the routes defined in that file.
Example:
If the file is users.php, all routes will be prefixed with users.
• middleware: Defines the default middleware applied to all routes registered by the module.
Example:
'middleware' => ['web', 'auth']
These settings allow you to tailor the package to your application’s specific routing needs.
License
This library is licensed under the MIT License. For more information, please see the license
file.