PHPackages                             geckods/laravel-routes - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. geckods/laravel-routes

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

geckods/laravel-routes
======================

Organize Laravel routes by feature/functionality instead of centralizing them in a single file

1.0.0(5mo ago)10MITPHPPHP ^8.2CI passing

Since Nov 17Pushed 5mo agoCompare

[ Source](https://github.com/Gecko-Digital-Solutions/laravel-routes)[ Packagist](https://packagist.org/packages/geckods/laravel-routes)[ Docs](https://geckods.com)[ RSS](/packages/geckods-laravel-routes/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

[![GitHub License](https://camo.githubusercontent.com/0ea531fb5c601af6d79658943cbd14e500c5f79beed6e18e1388171d6bc49418/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4765636b6f2d4469676974616c2d536f6c7574696f6e732f6c61726176656c2d726f757465733f6c6162656c436f6c6f723d326432643264)](LICENSE)[![Packagist Version](https://camo.githubusercontent.com/f0596c2caf3a3df7536dbc246beb3d26630cd1f15a98aa50b7fe9d6481b39d62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6765636b6f64732f6c61726176656c2d726f757465733f6c6162656c3d436f6d706f736572266c6f676f3d636f6d706f736572266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d326432643264)](https://packagist.org/packages/geckods/laravel-routes)[![PHP Version](https://camo.githubusercontent.com/c5fa91f1f3d5a13add23fa6011f93e6fd5ea0a3aef19234a5d6db3469674b77b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6765636b6f64732f6c61726176656c2d726f757465733f6c6f676f3d706870266c6f676f436f6c6f723d7733463434384468697465266c6162656c436f6c6f723d32643264326426636f6c6f723d334634343844)](composer.json)[![Laravel](https://camo.githubusercontent.com/cd63fe7ee57c67e5c058f9a8de30f5894bb5f10fabe94f7714a2a1b875bf6038/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6765636b6f64732f6c61726176656c2d726f757465732f6c61726176656c2f6672616d65776f726b3f6c6162656c3d4c61726176656c266c6f676f3d6c61726176656c266c6f676f436f6c6f723d464632443230266c6162656c436f6c6f723d32643264326426636f6c6f723d464632443230)](https://camo.githubusercontent.com/cd63fe7ee57c67e5c058f9a8de30f5894bb5f10fabe94f7714a2a1b875bf6038/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6765636b6f64732f6c61726176656c2d726f757465732f6c61726176656c2f6672616d65776f726b3f6c6162656c3d4c61726176656c266c6f676f3d6c61726176656c266c6f676f436f6c6f723d464632443230266c6162656c436f6c6f723d32643264326426636f6c6f723d464632443230)

[![Tests](https://github.com/Gecko-Digital-Solutions/laravel-routes/actions/workflows/ci.yml/badge.svg)](https://github.com/Gecko-Digital-Solutions/laravel-routes/actions/workflows/ci.yml)[![Coverage Status](https://camo.githubusercontent.com/99a5965a3f1e43f3608d361a43b6ad9e868e50212be1414e58cb2415f83b19a1/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4765636b6f2d4469676974616c2d536f6c7574696f6e732f6c61726176656c2d726f757465732f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/Gecko-Digital-Solutions/laravel-routes?branch=main)

Laravel Routes
==============

[](#laravel-routes)

Overview
--------

[](#overview)

**Laravel Routes** is a lightweight Laravel package that helps you organize application routes by feature or functionality instead of keeping them all in a single centralized file. This approach promotes better code organization, maintainability, and scalability in larger Laravel projects.

### Why Use Laravel Routes?

[](#why-use-laravel-routes)

- Feature-Based Organization: Group related routes by feature or module
- Modular Structure: Each feature can have its own route definitions
- Easy Configuration: Simple configuration to define where routes are located
- Well Tested: Comprehensive test suite with 27 passing tests
- Production Ready: Stable and reliable for production applications

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 10.0 or higher
- Composer

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require geckods/laravel-routes
```

The package will be automatically registered through Laravel's auto-discovery feature. No manual service provider registration is needed.

Configuration
-------------

[](#configuration)

### Publish Config File

[](#publish-config-file)

Publish the configuration file to your application:

```
php artisan vendor:publish --provider='GeckoDS\LaravelRoutes\Providers\LaravelRoutesProvider' --tag='config'
```

This creates `config/routes.php` with the following options:

```
return [
    // Path to search for route classes (supports glob patterns)
    'path' => app_path('Http/**/*.php'),

    // Namespace prefix for discovered route classes
    'prefix_namespace' => 'App\\',

    // Additional route classes not found in the path above
    'other_routes' => [],
];
```

### Auto-Publishing on Update

[](#auto-publishing-on-update)

To automatically publish the config on each Composer update, add this to your `composer.json`:

```
{
    "scripts": {
        "post-update-cmd": [
            "@php artisan vendor:publish --provider='GeckoDS\\LaravelRoutes\\Providers\\LaravelRoutesProvider' --tag='config' --ansi"
        ]
    }
}
```

Usage
-----

[](#usage)

### Basic Setup

[](#basic-setup)

In your route files (e.g., `routes/api.php` or `routes/web.php`), initialize the route controller:

```
