{"id":14975313,"url":"https://github.com/thedragoncode/laravel-route-names","last_synced_at":"2026-02-22T21:39:23.438Z","repository":{"id":37183339,"uuid":"466177936","full_name":"TheDragonCode/laravel-route-names","owner":"TheDragonCode","description":"Automatic generation of route names for your project","archived":false,"fork":false,"pushed_at":"2024-06-03T10:31:17.000Z","size":105,"stargazers_count":21,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-30T08:03:31.015Z","etag":null,"topics":["laravel","laravel-framework","laravel-package","names","naming","package","route","router","routes"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheDragonCode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://boosty.to/dragon-code","https://yoomoney.ru/to/410012608840929","https://www.donationalerts.com/r/dragon_code"]}},"created_at":"2022-03-04T15:39:10.000Z","updated_at":"2024-06-03T10:31:21.000Z","dependencies_parsed_at":"2024-01-16T05:07:35.891Z","dependency_job_id":"0cff17fe-996a-45f2-9524-a0874867aa17","html_url":"https://github.com/TheDragonCode/laravel-route-names","commit_stats":{"total_commits":92,"total_committers":4,"mean_commits":23.0,"dds":0.6521739130434783,"last_synced_commit":"6318ab857d0431ddc8630d816635a3140da65c1b"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDragonCode%2Flaravel-route-names","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDragonCode%2Flaravel-route-names/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDragonCode%2Flaravel-route-names/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheDragonCode%2Flaravel-route-names/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheDragonCode","download_url":"https://codeload.github.com/TheDragonCode/laravel-route-names/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238497654,"owners_count":19482294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","laravel-framework","laravel-package","names","naming","package","route","router","routes"],"created_at":"2024-09-24T13:51:51.450Z","updated_at":"2026-02-22T21:39:23.426Z","avatar_url":"https://github.com/TheDragonCode.png","language":"PHP","funding_links":["https://boosty.to/dragon-code","https://yoomoney.ru/to/410012608840929","https://www.donationalerts.com/r/dragon_code"],"categories":[],"sub_categories":[],"readme":"# Automatic Route Names for Laravel\n\n\u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://banners.beyondco.de/Laravel%20Route%20Names.png?pattern=topography\u0026style=style_2\u0026fontSize=100px\u0026md=1\u0026showWatermark=1\u0026theme=dark\u0026packageManager=composer+require\u0026packageName=dragon-code%2Flaravel-route-names\u0026description=Automatic+generation+of+route+names\u0026images=https%3A%2F%2Flaravel.com%2Fimg%2Flogomark.min.svg\"\u003e\n    \u003cimg src=\"https://banners.beyondco.de/Laravel%20Route%20Names.png?pattern=topography\u0026style=style_2\u0026fontSize=100px\u0026md=1\u0026showWatermark=1\u0026theme=light\u0026packageManager=composer+require\u0026packageName=dragon-code%2Flaravel-route-names\u0026description=Automatic+generation+of+route+names\u0026images=https%3A%2F%2Flaravel.com%2Fimg%2Flogomark.min.svg\" alt=\"Laravel Route Names\"\u003e\n\u003c/picture\u003e\n\n[![Stable Version][badge_stable]][link_packagist]\n[![Total Downloads][badge_downloads]][link_packagist]\n[![Github Workflow Status][badge_build]][link_build]\n[![License][badge_license]][link_license]\n\n## Installation\n\nTo get the latest version of `Laravel Route Names`, simply require the project\nusing [Composer](https://getcomposer.org):\n\n```bash\ncomposer require dragon-code/laravel-route-names\n```\n\n\u003e [!WARNING]\n\u003e\n\u003e For naming to work correctly, you need to replace the application class otherwise the code will be loaded too late.\n\u003e\n\u003e To do this, replace `Illuminate\\Foundation\\Application` with `DragonCode\\LaravelRouteNames\\Application` in the\n`bootstrap/app.php` file.\n\nYou can now list the routes, for example by calling the `php artisan route:list` command or by using\nthe [`dragon-code/pretty-routes`](https://github.com/TheDragonCode/pretty-routes) package.\n\n## Using\n\nThis is all. Now you don't have to specify route names. Now the route names will be generated automatically based on the\nfinal URL of your project.\n\n\u003e All previously specified route names in the application will be ignored.\n\u003e\n\u003e Compatible with all package solutions for expanding the list of routes.\n\nSince route names are generated at the time they are received, we recommend using route caching in production:\n\n```bash\nphp artisan route:cache\n\n// or\n\nphp artisan optimize\n```\n\n### Base Routes\n\n```php\napp('router')-\u003eget('/', [IndexController::class, 'index']);\napp('router')-\u003epost('/', [IndexController::class, 'store']);\napp('router')-\u003eput('/', [IndexController::class, 'update']);\napp('router')-\u003edelete('/', [IndexController::class, 'delete']);\napp('router')-\u003epatch('/', [IndexController::class, 'patch']);\napp('router')-\u003eoptions('/', [IndexController::class, 'options']);\n\napp('router')-\u003eget('{some}', [IndexController::class, 'index']);\napp('router')-\u003epost('{some}', [IndexController::class, 'store']);\napp('router')-\u003eput('{some}', [IndexController::class, 'update']);\napp('router')-\u003edelete('{some}', [IndexController::class, 'delete']);\napp('router')-\u003epatch('{some}', [IndexController::class, 'patch']);\napp('router')-\u003eoptions('{some}', [IndexController::class, 'options']);\n\napp('router')-\u003eget('pages', [PagesController::class, 'index']);\napp('router')-\u003epost('pages', [PagesController::class, 'store']);\napp('router')-\u003eput('pages/{page}', [PagesController::class, 'update']);\napp('router')-\u003edelete('pages/{page}', [PagesController::class, 'delete']);\napp('router')-\u003epatch('pages/{page}', [PagesController::class, 'patch']);\napp('router')-\u003eoptions('pages/{page}', [PagesController::class, 'options']);\n```\n\n| Method    | Url          | Name            | Helper                   |\n|-----------|--------------|-----------------|--------------------------|\n| GET, HEAD | `/`          | `main.index`    | `route('main.index')`    |\n| POST      | `/`          | `main.store`    | `route('main.store')`    |\n| PUT       | `/`          | `main.update`   | `route('main.update')`   |\n| DELETE    | `/`          | `main.destroy`  | `route('main.destroy')`  |\n| PATCH     | `/`          | `main.patch`    | `route('main.patch')`    |\n| OPTIONS   | `/`          | `main.options`  | `route('main.options')`  |\n| GET, HEAD | `{some}`     | `some.index`    | `route('some.index')`    |\n| POST      | `{some}`     | `some.store`    | `route('some.store')`    |\n| PUT       | `{some}`     | `some.update`   | `route('some.update')`   |\n| DELETE    | `{some}`     | `some.destroy`  | `route('some.destroy')`  |\n| PATCH     | `{some}`     | `some.patch`    | `route('some.patch')`    |\n| OPTIONS   | `{some}`     | `some.options`  | `route('some.options')`  |\n| GET, HEAD | `/pages`     | `pages.index`   | `route('pages.index')`   |\n| POST      | `/pages`     | `pages.store`   | `route('pages.store')`   |\n| PUT       | `/pages/123` | `pages.update`  | `route('pages.update')`  |\n| DELETE    | `/pages/123` | `pages.destroy` | `route('pages.destroy')` |\n| PATCH     | `/pages/123` | `pages.patch`   | `route('pages.patch')`   |\n| OPTIONS   | `/pages/123` | `pages.options` | `route('pages.options')` |\n\n### Resource Routes\n\n```php\napp('router')-\u003eresource('authors/{author}/photos', Author\\PhotoController::class);\n```\n\n| Method    | Url                                | Name                     | Helper                            |\n|-----------|------------------------------------|--------------------------|-----------------------------------|\n| GET, HEAD | `/authors/123/photos`              | `authors.photos.index`   | `route('authors.photos.index')`   |\n| GET, HEAD | `/authors/123/photos/create`       | `authors.photos.create`  | `route('authors.photos.create')`  |\n| POST      | `/authors/123/photos`              | `authors.photos.store`   | `route('authors.photos.store')`   |\n| GET       | `/authors/123/photos/{photo}`      | `authors.photos.show`    | `route('authors.photos.show')`    |\n| GET       | `/authors/123/photos/{photo}/edit` | `authors.photos.edit`    | `route('authors.photos.edit')`    |\n| PUT       | `/authors/123/photos/{photo}`      | `authors.photos.update`  | `route('authors.photos.update')`  |\n| PATCH     | `/authors/123/photos/{photo}`      | `authors.photos.patch`   | `route('authors.photos.patch')`   |\n| DELETE    | `/authors/123/photos/{photo}`      | `authors.photos.destroy` | `route('authors.photos.destroy')` |\n\n### API Resource Routes\n\n```php\napp('router')-\u003eapiResource('authors/{author}/photos', Author\\PhotoController::class);\n```\n\n| Method    | Url                           | Name                     | Helper                            |\n|-----------|-------------------------------|--------------------------|-----------------------------------|\n| GET, HEAD | `/authors/123/photos`         | `authors.photos.index`   | `route('authors.photos.index')`   |\n| POST      | `/authors/123/photos`         | `authors.photos.store`   | `route('authors.photos.store')`   |\n| GET       | `/authors/123/photos/{photo}` | `authors.photos.show`    | `route('authors.photos.show')`    |\n| PUT       | `/authors/123/photos/{photo}` | `authors.photos.update`  | `route('authors.photos.update')`  |\n| PATCH     | `/authors/123/photos/{photo}` | `authors.photos.patch`   | `route('authors.photos.patch')`   |\n| DELETE    | `/authors/123/photos/{photo}` | `authors.photos.destroy` | `route('authors.photos.destroy')` |\n\n### List of exclusions\n\nBy publishing a configuration file with the artisan command, you can explicitly specify a mask of route names that do\nnot need to be translated:\n\n```bash\nphp artisan vendor:publish --provider=\"DragonCode\\LaravelRouteNames\\ServiceProvider\"\n```\n\n### Exceptions\n\n```php\napp('router')\n    -\u003eget('pages', [IndexController::class, 'index'])\n    -\u003ename('my_pages');\n\nreturn route('my_pages');\n//  \\Symfony\\Component\\Routing\\Exception\\RouteNotFoundException\n//  Route [my_pages] not defined.\n\nreturn route('pages.index');\n// Returns the result of executing the `IndexController@index` method.\n```\n\n## Result\n\n```php\napp('router')\n    -\u003ename('pages.')\n    -\u003eprefix('pages')\n    -\u003egroup(function () {\n        app('router')-\u003eget('/', [Controller::class, 'index']);\n        app('router')-\u003epost('/', [Controller::class, 'store']);\n        app('router')-\u003eget('{page}', [Controller::class, 'show']);\n        app('router')-\u003edelete('{page}', [Controller::class, 'destroy']);\n    });\n```\n\n**Before:**\n\n```bash\nGET     /pages         pages.\nPOST    /pages         pages.\nGET     /pages/{page}  pages.\nDELETE  /pages/{page}  pages.\n```\n\n**After:**\n\n```bash\nGET     /pages         pages.index\nPOST    /pages         pages.store\nGET     /pages/{page}  pages.show\nDELETE  /pages/{page}  pages.destroy\n```\n\n## License\n\nThis package is licensed under the [MIT License](LICENSE).\n\n\n[badge_build]:          https://img.shields.io/github/actions/workflow/status/TheDragonCode/laravel-route-names/phpunit.yml?style=flat-square\n\n[badge_downloads]:      https://img.shields.io/packagist/dt/dragon-code/laravel-route-names.svg?style=flat-square\n\n[badge_license]:        https://img.shields.io/packagist/l/dragon-code/laravel-route-names.svg?style=flat-square\n\n[badge_stable]:         https://img.shields.io/github/v/release/TheDragonCode/laravel-route-names?label=stable\u0026style=flat-square\n\n[link_build]:           https://github.com/TheDragonCode/laravel-route-names/actions\n\n[link_license]:         LICENSE\n\n[link_packagist]:       https://packagist.org/packages/dragon-code/laravel-route-names\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedragoncode%2Flaravel-route-names","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthedragoncode%2Flaravel-route-names","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedragoncode%2Flaravel-route-names/lists"}