PHPackages                             dragon-code/laravel-route-names - 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. dragon-code/laravel-route-names

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

dragon-code/laravel-route-names
===============================

Automatic generation of route names

2.2.0(3mo ago)259.2k1MITPHPPHP ^8.2CI passing

Since Mar 5Pushed 1w ago1 watchersCompare

[ Source](https://github.com/TheDragonCode/laravel-route-names)[ Packagist](https://packagist.org/packages/dragon-code/laravel-route-names)[ Fund](https://boosty.to/dragon-code)[ Fund](https://yoomoney.ru/to/410012608840929)[ RSS](/packages/dragon-code-laravel-route-names/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (10)Versions (15)Used By (1)

Automatic Route Names for Laravel
=================================

[](#automatic-route-names-for-laravel)

  ![Laravel Route Names](https://camo.githubusercontent.com/5413be64ffe002831d6931430fbced7ed32844db12309d4a03546c62642b46e4/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c253230526f7574652532304e616d65732e706e673f7061747465726e3d746f706f677261706879267374796c653d7374796c655f3226666f6e7453697a653d3130307078266d643d312673686f7757617465726d61726b3d31267468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d647261676f6e2d636f64652532466c61726176656c2d726f7574652d6e616d6573266465736372697074696f6e3d4175746f6d617469632b67656e65726174696f6e2b6f662b726f7574652b6e616d657326696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)[![Stable Version](https://camo.githubusercontent.com/753849d568ed6313dc6d9965d34cf05e73549812030b485fb92329bebadc726f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f546865447261676f6e436f64652f6c61726176656c2d726f7574652d6e616d65733f6c6162656c3d737461626c65267374796c653d666c61742d737175617265)](https://packagist.org/packages/dragon-code/laravel-route-names)[![Total Downloads](https://camo.githubusercontent.com/fec2f8fe69bba3d33fea03d2452b9770952b9b4044c5e6da99efd953c51108e6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f647261676f6e2d636f64652f6c61726176656c2d726f7574652d6e616d65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dragon-code/laravel-route-names)[![Github Workflow Status](https://camo.githubusercontent.com/7259ab1d0eef5245e92a34d5f52bf1cdc2404b1fb02533dbe6ae9690a7309155/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f546865447261676f6e436f64652f6c61726176656c2d726f7574652d6e616d65732f706870756e69742e796d6c3f7374796c653d666c61742d737175617265)](https://github.com/TheDragonCode/laravel-route-names/actions)[![License](https://camo.githubusercontent.com/6c4dae32f86f79a50d116f86d9bac4cc60cabe2d1b4c6af503cfdc7819000986/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f647261676f6e2d636f64652f6c61726176656c2d726f7574652d6e616d65732e7376673f7374796c653d666c61742d737175617265)](LICENSE)

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

[](#installation)

To get the latest version of `Laravel Route Names`, simply require the project using [Composer](https://getcomposer.org):

```
composer require dragon-code/laravel-route-names
```

Warning

For naming to work correctly, you need to replace the application class otherwise the code will be loaded too late.

To do this, replace `Illuminate\Foundation\Application` with `DragonCode\LaravelRouteNames\Application` in the `bootstrap/app.php` file.

You can now list the routes, for example by calling the `php artisan route:list` command or by using the [`dragon-code/pretty-routes`](https://github.com/TheDragonCode/pretty-routes) package.

Using
-----

[](#using)

This is all. Now you don't have to specify route names. Now the route names will be generated automatically based on the final URL of your project.

> All previously specified route names in the application will be ignored.
>
> Compatible with all package solutions for expanding the list of routes.

Since route names are generated at the time they are received, we recommend using route caching in production:

```
php artisan route:cache

// or

php artisan optimize
```

### Base Routes

[](#base-routes)

```
app('router')->get('/', [IndexController::class, 'index']);
app('router')->post('/', [IndexController::class, 'store']);
app('router')->put('/', [IndexController::class, 'update']);
app('router')->delete('/', [IndexController::class, 'delete']);
app('router')->patch('/', [IndexController::class, 'patch']);
app('router')->options('/', [IndexController::class, 'options']);

app('router')->get('{some}', [IndexController::class, 'index']);
app('router')->post('{some}', [IndexController::class, 'store']);
app('router')->put('{some}', [IndexController::class, 'update']);
app('router')->delete('{some}', [IndexController::class, 'delete']);
app('router')->patch('{some}', [IndexController::class, 'patch']);
app('router')->options('{some}', [IndexController::class, 'options']);

app('router')->get('pages', [PagesController::class, 'index']);
app('router')->post('pages', [PagesController::class, 'store']);
app('router')->put('pages/{page}', [PagesController::class, 'update']);
app('router')->delete('pages/{page}', [PagesController::class, 'delete']);
app('router')->patch('pages/{page}', [PagesController::class, 'patch']);
app('router')->options('pages/{page}', [PagesController::class, 'options']);
```

MethodUrlNameHelperGET, HEAD`/``main.index``route('main.index')`POST`/``main.store``route('main.store')`PUT`/``main.update``route('main.update')`DELETE`/``main.destroy``route('main.destroy')`PATCH`/``main.patch``route('main.patch')`OPTIONS`/``main.options``route('main.options')`GET, HEAD`{some}``some.index``route('some.index')`POST`{some}``some.store``route('some.store')`PUT`{some}``some.update``route('some.update')`DELETE`{some}``some.destroy``route('some.destroy')`PATCH`{some}``some.patch``route('some.patch')`OPTIONS`{some}``some.options``route('some.options')`GET, HEAD`/pages``pages.index``route('pages.index')`POST`/pages``pages.store``route('pages.store')`PUT`/pages/123``pages.update``route('pages.update')`DELETE`/pages/123``pages.destroy``route('pages.destroy')`PATCH`/pages/123``pages.patch``route('pages.patch')`OPTIONS`/pages/123``pages.options``route('pages.options')`### Resource Routes

[](#resource-routes)

```
app('router')->resource('authors/{author}/photos', Author\PhotoController::class);
```

MethodUrlNameHelperGET, HEAD`/authors/123/photos``authors.photos.index``route('authors.photos.index')`GET, HEAD`/authors/123/photos/create``authors.photos.create``route('authors.photos.create')`POST`/authors/123/photos``authors.photos.store``route('authors.photos.store')`GET`/authors/123/photos/{photo}``authors.photos.show``route('authors.photos.show')`GET`/authors/123/photos/{photo}/edit``authors.photos.edit``route('authors.photos.edit')`PUT`/authors/123/photos/{photo}``authors.photos.update``route('authors.photos.update')`PATCH`/authors/123/photos/{photo}``authors.photos.patch``route('authors.photos.patch')`DELETE`/authors/123/photos/{photo}``authors.photos.destroy``route('authors.photos.destroy')`### API Resource Routes

[](#api-resource-routes)

```
app('router')->apiResource('authors/{author}/photos', Author\PhotoController::class);
```

MethodUrlNameHelperGET, HEAD`/authors/123/photos``authors.photos.index``route('authors.photos.index')`POST`/authors/123/photos``authors.photos.store``route('authors.photos.store')`GET`/authors/123/photos/{photo}``authors.photos.show``route('authors.photos.show')`PUT`/authors/123/photos/{photo}``authors.photos.update``route('authors.photos.update')`PATCH`/authors/123/photos/{photo}``authors.photos.patch``route('authors.photos.patch')`DELETE`/authors/123/photos/{photo}``authors.photos.destroy``route('authors.photos.destroy')`### List of exclusions

[](#list-of-exclusions)

By publishing a configuration file with the artisan command, you can explicitly specify a mask of route names that do not need to be translated:

```
php artisan vendor:publish --provider="DragonCode\LaravelRouteNames\ServiceProvider"
```

### Exceptions

[](#exceptions)

```
app('router')
    ->get('pages', [IndexController::class, 'index'])
    ->name('my_pages');

return route('my_pages');
//  \Symfony\Component\Routing\Exception\RouteNotFoundException
//  Route [my_pages] not defined.

return route('pages.index');
// Returns the result of executing the `IndexController@index` method.
```

Result
------

[](#result)

```
app('router')
    ->name('pages.')
    ->prefix('pages')
    ->group(function () {
        app('router')->get('/', [Controller::class, 'index']);
        app('router')->post('/', [Controller::class, 'store']);
        app('router')->get('{page}', [Controller::class, 'show']);
        app('router')->delete('{page}', [Controller::class, 'destroy']);
    });
```

**Before:**

```
GET     /pages         pages.
POST    /pages         pages.
GET     /pages/{page}  pages.
DELETE  /pages/{page}  pages.
```

**After:**

```
GET     /pages         pages.index
POST    /pages         pages.store
GET     /pages/{page}  pages.show
DELETE  /pages/{page}  pages.destroy
```

License
-------

[](#license)

This package is licensed under the [MIT License](LICENSE).

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance90

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 60.1% 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 ~134 days

Recently: every ~80 days

Total

12

Last Release

104d ago

Major Versions

1.6.1 → 2.0.02025-04-30

PHP version history (2 changes)v1.0.0PHP ^7.4 || ^8.0

2.0.0PHP ^8.2

### Community

Maintainers

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

---

Top Contributors

[![andrey-helldar](https://avatars.githubusercontent.com/u/10347617?v=4)](https://github.com/andrey-helldar "andrey-helldar (95 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (31 commits)")[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (25 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")[![guanguans](https://avatars.githubusercontent.com/u/22309277?v=4)](https://github.com/guanguans "guanguans (3 commits)")

---

Tags

laravellaravel-frameworklaravel-packagenamesnamingpackagerouterouterrouteslaravelroutesroutingdragon codenamesnaming

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/dragon-code-laravel-route-names/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[lord/laroute

Access Laravels URL/Route helper functions, from JavaScript.

8022.0M8](/packages/lord-laroute)[dragon-code/pretty-routes

Pretty Routes for Laravel

10065.5k4](/packages/dragon-code-pretty-routes)

PHPackages © 2026

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