PHPackages                             ricventu/laravel-route-maze - 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. ricventu/laravel-route-maze

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

ricventu/laravel-route-maze
===========================

A quick and easy way to create the routes is to take advantage of the convention over configuration

v1.1.4(1y ago)0892MITPHPPHP ^8.1

Since Nov 23Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/ricventu/laravel-route-maze)[ Packagist](https://packagist.org/packages/ricventu/laravel-route-maze)[ Docs](https://github.com/ricventu/laravel-route-maze)[ Fund](https://ko-fi.com/ricventu)[ RSS](/packages/ricventu-laravel-route-maze/feed)WikiDiscussions main Synced yesterday

READMEChangelog (8)Dependencies (13)Versions (15)Used By (0)

Convention over configuration Laravel route generator
=====================================================

[](#convention-over-configuration-laravel-route-generator)

Warning

**This project is archived and no longer maintained.**

Please use [spatie/laravel-route-discovery](https://github.com/spatie/laravel-route-discovery) instead, which I have contributed to and provides the same convention-over-configuration approach to route generation.

[![Latest Version on Packagist](https://camo.githubusercontent.com/9087852c13fed805f8210976450d522f4864625ed96e878e760616ed4ebb36f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72696376656e74752f6c61726176656c2d726f7574652d6d617a652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ricventu/laravel-route-maze)[![GitHub Tests Action Status](https://camo.githubusercontent.com/084104837104af258c37d3e0ae72fa9673a117b028514e9cf76dd0afe9a0db8a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72696376656e74752f6c61726176656c2d726f7574652d6d617a652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/ricventu/laravel-route-maze/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/758f8cad1cab68861076d442b020b892ccf9df4db11d151a2b0079a7c5884d41/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72696376656e74752f6c61726176656c2d726f7574652d6d617a652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/ricventu/laravel-route-maze/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/334fc55c86b3790e69d8f5c10548a31d35f0e5af0760a44ad24dd1a683033207/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72696376656e74752f6c61726176656c2d726f7574652d6d617a652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ricventu/laravel-route-maze)

A quick and easy way to auto generate routes, is to take advantage of the **convention over configuration** and **PHP attributes**.
This means that routes are automatically generated based on the directory structure of the controllers and the methods attributes.
In this way, you don't have to manually write the routes in the web.php or api.php file, but just follow some rules of file naming and organization.
Route groups are base on subdirectories of the controllers.

Let's see how to do it with a practical example.

Controller: `App/Http/Controllers/SomeCategory/ProductsController.php`

```
class ProductsController
{
    // index and __invoke defaults to GET
    public function index() {...}
    #[Get]
    public function show($id) {...}
    #[Post]
    public function store(Request $request) {...}
    #[Patch]
    public function update($id, Request $request) {...}
    #[Delete]
    public function destroy($id) {...}
}
```

To get routes simpli add the the following line to `routes/web.php`

```
    Route::maze(app_path('Http/Controllers'), 'App\\Http\\Controllers');
```

The generated routes are:

```
    Route::get('/some-category/products', 'SomeCategory\ProductsController@index')->name('some-category.products');
    Route::get('/some-category/products/show/{id}', 'SomeCategory\ProductsController@show')->name('some-category.products.show');
    Route::post('/some-category/products/store', 'SomeCategory\ProductsController@store')->name('some-category.products.store');
    Route::Patch('/some-category/products/update/{id}', 'SomeCategory\ProductsController@update')->name('some-category.products.update');
    Route::delete('/some-category/products/destroy/{id}', 'SomeCategory\ProductsController@destroy')->name('some-category.products.destroy');
```

Parameters in path
------------------

[](#parameters-in-path)

Parameters can be specified in the path naming the directory with `_param-name_`.

`Http/Controllers/_param1_/ItemsController.php`

```
class ItemsController
{
    #[Get]
    public function get($id) {...}
}
```

becomes

```
    Route::get('/{param1}/items/get/{id}', 'ItemsController@get')->name('items.get');
```

Middleware
----------

[](#middleware)

You can specify middleware group by adding a file named `middleware.php` in the controller directory.

```
return [
    'auth',
];
```

Naming conventions
------------------

[](#naming-conventions)

Uri and route name are composed of directories name, first part of the controller name (before `Controller`) and method name, all in kebab-case.

examples:

Controller nameMethod nameRoute nameRoute pathSomeProductControllershowItem($id)some.product.show-item/some-product/show-item/{id}SomeProductControllerstoreItemsome.product.store-item/some-product/store-itemSomeProductControllerupdateItem($id)some.product.update-item/some-product/update-item/{id}SomeProductControllerdestroyItem($id)some.product.destroy-item/some-product/destroy-item/{id}Disable discover for a Controller
---------------------------------

[](#disable-discover-for-a-controller)

To disable route discover for a specified crontroller, add static method `mazeDisabled` that returns `true`

In path configuration
---------------------

[](#in-path-configuration)

If in the path is present a file named `maze.php`, it will be used to configure the route group.

```
return [
];
```

KeyDescriptionDefaultignore\_path\_nameIgnore path and name in routefalsedisabledDisable discovering of the entire path```
## Installation

You can install the package via composer:

```bash
composer require ricventu/laravel-route-maze
```

Usage
-----

[](#usage)

```
    Route::maze(app_path('Http/Controllers'), 'App\\Http\\Controllers');
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Performance note
----------------

[](#performance-note)

In production deployment, it's recommended to cache route discovering using Laravel `route:cache` built in command

Credits
-------

[](#credits)

- [Riccardo Venturini](https://github.com/ricventu)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance67

Regular maintenance activity

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~62 days

Recently: every ~109 days

Total

8

Last Release

518d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab9a6e1dbd1cea7ad570eba962e9f4d64938b8c2f96199da62056cc60d06cb25?d=identicon)[ricventu](/maintainers/ricventu)

---

Top Contributors

[![ricventu](https://avatars.githubusercontent.com/u/3369838?v=4)](https://github.com/ricventu "ricventu (87 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")

---

Tags

generatorlaravelroutesricventularavel-route-maze

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ricventu-laravel-route-maze/health.svg)

```
[![Health](https://phpackages.com/badges/ricventu-laravel-route-maze/health.svg)](https://phpackages.com/packages/ricventu-laravel-route-maze)
```

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

124603.0k](/packages/worksome-exchange)[stephenjude/laravel-wallet

A simple wallet implementation for Laravel

26611.9k](/packages/stephenjude-laravel-wallet)[tapp/filament-form-builder

User facing form builder using Filament components

132.4k3](/packages/tapp-filament-form-builder)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
