PHPackages                             sebastiaanluca/laravel-router - 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. sebastiaanluca/laravel-router

AbandonedArchivedLibrary

sebastiaanluca/laravel-router
=============================

An organized approach to handling Laravel routes.

10.0.0(5y ago)13216.3k↑100%132MITPHPPHP ^7.3

Since Apr 8Pushed 5y ago5 watchersCompare

[ Source](https://github.com/sebastiaanluca/laravel-router)[ Packagist](https://packagist.org/packages/sebastiaanluca/laravel-router)[ Docs](https://github.com/sebastiaanluca/laravel-router)[ RSS](/packages/sebastiaanluca-laravel-router/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (5)Versions (28)Used By (2)

Laravel Router
==============

[](#laravel-router)

[![Latest stable release](https://camo.githubusercontent.com/753da2516255bb63ca49e3257044c906c8817f51482ad1b136a62c24cf336219/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7365626173746961616e6c7563612f6c61726176656c2d726f757465722e7376673f6c6162656c3d737461626c65)](https://packagist.org/packages/sebastiaanluca/laravel-router)[![Software license](https://camo.githubusercontent.com/08662bb339bee903c7279b82f3217310d3f196fdfa63b019d294ae85e1a5d7d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d696e666f726d6174696f6e616c2e737667)](LICENSE.md)[![Build status](https://camo.githubusercontent.com/a05e3f59e4c226b3ab888e17e7e6a84a404049d88eceac686ef61856800dcdad/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7365626173746961616e6c7563612f6c61726176656c2d726f757465722f6d61737465722e737667)](https://travis-ci.org/sebastiaanluca/laravel-router)[![Total downloads](https://camo.githubusercontent.com/969501489af4dc475170c60e7ae1ab7169d79497a83f6fe390a63a94917b42ba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7365626173746961616e6c7563612f6c61726176656c2d726f757465722e7376673f636f6c6f723d627269676874677265656e)](https://packagist.org/packages/sebastiaanluca/laravel-router)[![Total stars](https://camo.githubusercontent.com/62ffe950f1359a1b0a16163f1969c9d0e7ead436e192be8e8c285f67aba1b48e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f7365626173746961616e6c7563612f6c61726176656c2d726f757465722e7376673f636f6c6f723d627269676874677265656e)](https://github.com/sebastiaanluca/laravel-router)

[![Read my blog](https://camo.githubusercontent.com/0760b582e22202bd412feb64f5f87b6459f64a0b8ea5fdd24cbadf87df736177/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c696e6b2d626c6f672d6c69676874677265792e737667)](https://blog.sebastiaanluca.com)[![View my other packages and projects](https://camo.githubusercontent.com/5ce3a83ee0ec2b4ae47a99f67347c1d8e78582757eca80fe31c98e5bd0e2185a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c696e6b2d6f746865725f7061636b616765732d6c69676874677265792e737667)](https://packagist.org/packages/sebastiaanluca)[![Follow @sebastiaanluca on Twitter](https://camo.githubusercontent.com/bde346ed8efc8b2458386b36256c64e3fe010276f449b80fe4f663c4c8bbd83e/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f7365626173746961616e6c7563612e7376673f7374796c653d736f6369616c)](https://twitter.com/sebastiaanluca)[![Share this package on Twitter](https://camo.githubusercontent.com/cb820a0ecc9645168e33b03925d7f14691262ddbaeaf66a0a91697803d0cba2d/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c2f687474702f736869656c64732e696f2e7376673f7374796c653d736f6369616c)](https://twitter.com/home?status=Check%20out%20this%20nifty%20way%20of%20organizing%20your%20%23Laravel%20routes!%20https%3A//github.com/sebastiaanluca/laravel-router%20via%20%40sebastiaanluca)

**An organized approach to handling routes in Laravel.**

This package provides you with an easy-to-use system to separate route logic into **routers** based on functionality while also providing additional functionality. A replacement for those bulky `web.php` and `api.php` route files that are often lacking any structure and break Laravel structure conventions of separating everything in classes instead of regular PHP files.

Do note that it *changes nothing to the way you define your routes*. It's just a way of organizing them. Optionally you can use the additional functionality it provides, but that's not a requirement.

Table of contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [How to install](#how-to-install)
    - [Further optional setup](#further-optional-setup)
- [How to use](#how-to-use)
    - [Creating a router](#creating-a-router)
    - [Registering the router](#registering-the-router)
        - [Manually registering the router](#manually-registering-the-router)
- [Optional features](#optional-features)
    - [Common route parameter patterns](#common-route-parameter-patterns)
    - [Full-domain routing](#full-domain-routing)
- [License](#license)
- [Change log](#change-log)
- [Testing](#testing)
- [Contributing](#contributing)
- [Security](#security)
- [Credits](#credits)
- [About](#about)

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

[](#requirements)

- PHP 7.3 or higher
- Laravel 7.0 or higher

Looking for support for earlier versions? Try out any of the previous package versions.

How to install
--------------

[](#how-to-install)

Just add the package to your project using Composer and Laravel will auto-discover it:

```
composer require sebastiaanluca/laravel-router
```

### Further optional setup

[](#further-optional-setup)

If you want to be able to register your routers **in a single place**, add the `RegistersRouters` trait to your HTTP kernel (found at `App\Http\Kernel`):

```
