PHPackages                             sulimanbenhalim/route-hints - 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. sulimanbenhalim/route-hints

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

sulimanbenhalim/route-hints
===========================

Intelligent 'did you mean?' route suggestions for Laravel 404 errors

1.0.2(8mo ago)24MITPHPPHP ^8.2CI passing

Since Aug 18Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/sulimanbenhalim/route-hints)[ Packagist](https://packagist.org/packages/sulimanbenhalim/route-hints)[ RSS](/packages/sulimanbenhalim-route-hints/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (8)Versions (4)Used By (0)

RouteHints Laravel Package
==========================

[](#routehints-laravel-package)

[![GitHub License](https://camo.githubusercontent.com/cb69e92f6e7abc2b3c6e8ad463fe4e778b6a407c68609003b6783ec2e5325100/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f73756c696d616e62656e68616c696d2f726f7574652d68696e7473)](https://github.com/sulimanbenhalim/route-hints/blob/main/LICENSE.md)[![PHP Version Support](https://camo.githubusercontent.com/2a38189ebddcd255237b8da46df2e1435923035f259b9e4b261fd98ad4e9cea2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e322d626c7565)](https://www.php.net/supported-versions.php)[![Laravel Version Support](https://camo.githubusercontent.com/1bc65cbe3b5a8d0fa3c453b8f066ce33d867c978dcab5342b4d1bb3a9358f1a6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25334525334425323031312e302d726564)](https://laravel.com/docs/11.x/releases)

> Laravel 404 errors → intelligent route suggestions

Install
-------

[](#install)

```
composer require sulimanbenhalim/route-hints
```

Usage
-----

[](#usage)

### Routes Control

[](#routes-control)

All routes discoverable by default

```
Route::get('/users', UserController::class);                    // ✓ Suggested
Route::get('/posts', PostController::class)->discoverable();    // ✓ Explicitly suggested
Route::get('/admin', AdminController::class)->hidden();         // ✗ Never suggested
```

### Custom Keywords

[](#custom-keywords)

```
Route::get('/dashboard', HomeController::class)
    ->withHints(['home', 'control-panel']);
```

`/home` → suggests `/dashboard`

### Parameterized Routes

[](#parameterized-routes)

```
Route::get('/posts/{post}', PostController::class)
    ->includeParameterized(['post' => 'welcome']);
```

`/post` → suggests `/posts/welcome`

### Programmatic Access

[](#programmatic-access)

```
$suggestions = app('route-hints')->findSuggestions(request());
$suggestions = RouteHints::findSuggestions(request());
```

Responses
---------

[](#responses)

Request TypeResponse**HTML**Default Laravel 404 view with clickable suggestions**JSON**`{"suggestions": [{"url": "http://app.test/users"}]}`**Auto-redirect**Direct redirect when similarity &gt; thresholdAuto-Redirect Setup
-------------------

[](#auto-redirect-setup)

> **Required for session-based auto-redirect**

Add to `bootstrap/app.php`:

```
->withMiddleware(function (Middleware $middleware): void {
    $middleware->prepend(\Illuminate\Session\Middleware\StartSession::class);
})

// Or running this command, mentioned blow in the docs
// php artisan route-hints:setup-session
```

**Auto-redirect Data:**

```
// Query method adds URL parameters:
// /users?route_corrected_from=%2Fuser&similarity=90.5&route_name=users.index

// Session method stores structured data:
session('route_hints_correction') = [
    'original_path' => '/user',
    'corrected_path' => '/users',
    'similarity_percentage' => 90.5,
    'route_name' => 'users.index',
    'corrected_at' => '2024-01-15T...'
];
```

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

[](#configuration)

```
php artisan vendor:publish --tag=route-hints-config
```

**All Settings**SettingDefaultDescription`enabled``true`Enable/disable route hints`max_distance``5`Levenshtein distance limit`max_suggestions``3`How many to show`default_discoverable``true`Routes discoverable by default`excluded_patterns``[]`Never suggest these routes`cache_ttl``3600`Cache discoverable routes (seconds)`show_similarity_percentage``false`Show similarity % in responses`show_route_names_json``false`Include route names in JSON`show_route_names_view``false`Show route names in HTML`auto_redirect.enabled``false`Auto-redirect feature`auto_redirect.threshold``80`Similarity % needed for redirect`auto_redirect.method``session`How to pass correction info`auto_redirect.query_param``route_corrected_from`Query parameter name`auto_redirect.session_key``route_hints_correction`Session key nameCommands
--------

[](#commands)

```
php artisan route-hints:analyze [path]    # Test route suggestions for any path
php artisan route-hints:cache build       # Build route cache for performance
php artisan route-hints:cache status      # Check cache status and info
php artisan route-hints:cache clear       # Clear route cache
php artisan route-hints:setup-session     # Configure auto-redirect session
```

Examples
--------

[](#examples)

User TypesGets SuggestedWhy`/user``/users`Typo correction`/dashbord``/dashboard`Spelling mistake`/home``/dashboard`Custom hint`/product-categories``/categories/electronics`Parameterized with defaultTesting
-------

[](#testing)

The package includes a comprehensive test suite:

```
composer test
```

Laravel Version Compatibility
-----------------------------

[](#laravel-version-compatibility)

Laravel VersionPackage Version11.x1.x12.x1.xSecurity
--------

[](#security)

If you discover any security issues, please email  instead of using the issue tracker.

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance66

Regular maintenance activity

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~2 days

Total

3

Last Release

261d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f7720f88731294f320b81cfdab22d8a12ed4f49cc2502f0f54fc989f3c6ef6f?d=identicon)[sulimanbenhalim](/maintainers/sulimanbenhalim)

---

Top Contributors

[![sulimanbenhalim](https://avatars.githubusercontent.com/u/44615499?v=4)](https://github.com/sulimanbenhalim "sulimanbenhalim (6 commits)")

---

Tags

404laravelmiddlewarepackagephproutingsuggestionsuxlaravelrouting404uxsuggestions

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sulimanbenhalim-route-hints/health.svg)

```
[![Health](https://phpackages.com/badges/sulimanbenhalim-route-hints/health.svg)](https://phpackages.com/packages/sulimanbenhalim-route-hints)
```

###  Alternatives

[watson/active

Laravel helper for recognising the current route, controller and action

3253.6M14](/packages/watson-active)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[dragon-code/pretty-routes

Pretty Routes for Laravel

10058.7k4](/packages/dragon-code-pretty-routes)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k1](/packages/bjuppa-laravel-blog)

PHPackages © 2026

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