{"id":37013578,"url":"https://github.com/sulimanbenhalim/route-hints","last_synced_at":"2026-01-14T01:20:15.052Z","repository":{"id":310499902,"uuid":"1040058116","full_name":"sulimanbenhalim/route-hints","owner":"sulimanbenhalim","description":"Laravel 404 errors → intelligent route suggestions","archived":false,"fork":false,"pushed_at":"2025-08-22T12:15:08.000Z","size":26,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-21T10:15:34.957Z","etag":null,"topics":["404","laravel","middleware","package","php","routing","suggestions","ux"],"latest_commit_sha":null,"homepage":null,"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/sulimanbenhalim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-18T11:50:08.000Z","updated_at":"2025-08-22T12:16:14.000Z","dependencies_parsed_at":"2025-08-25T04:18:19.008Z","dependency_job_id":null,"html_url":"https://github.com/sulimanbenhalim/route-hints","commit_stats":null,"previous_names":["sulimanbenhalim/route-hints"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sulimanbenhalim/route-hints","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulimanbenhalim%2Froute-hints","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulimanbenhalim%2Froute-hints/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulimanbenhalim%2Froute-hints/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulimanbenhalim%2Froute-hints/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sulimanbenhalim","download_url":"https://codeload.github.com/sulimanbenhalim/route-hints/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sulimanbenhalim%2Froute-hints/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28407673,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["404","laravel","middleware","package","php","routing","suggestions","ux"],"created_at":"2026-01-14T01:20:14.294Z","updated_at":"2026-01-14T01:20:14.994Z","avatar_url":"https://github.com/sulimanbenhalim.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RouteHints Laravel Package\n\n[![GitHub License](https://img.shields.io/github/license/sulimanbenhalim/route-hints)](https://github.com/sulimanbenhalim/route-hints/blob/main/LICENSE.md)\n[![PHP Version Support](https://img.shields.io/badge/php-%3E%3D%208.2-blue)](https://www.php.net/supported-versions.php)\n[![Laravel Version Support](https://img.shields.io/badge/laravel-%3E%3D%2011.0-red)](https://laravel.com/docs/11.x/releases)\n\n\u003e Laravel 404 errors → intelligent route suggestions\n\n## Install\n\n```bash\ncomposer require sulimanbenhalim/route-hints\n```\n\n## Usage\n\n### Routes Control\nAll routes discoverable by default\n\n```php\nRoute::get('/users', UserController::class);                    // ✓ Suggested  \nRoute::get('/posts', PostController::class)-\u003ediscoverable();    // ✓ Explicitly suggested\nRoute::get('/admin', AdminController::class)-\u003ehidden();         // ✗ Never suggested\n```\n\n### Custom Keywords\n```php\nRoute::get('/dashboard', HomeController::class)\n    -\u003ewithHints(['home', 'control-panel']);\n```\n`/home` → suggests `/dashboard`\n\n### Parameterized Routes\n```php\nRoute::get('/posts/{post}', PostController::class)\n    -\u003eincludeParameterized(['post' =\u003e 'welcome']);\n```\n`/post` → suggests `/posts/welcome`\n\n### Programmatic Access\n```php\n$suggestions = app('route-hints')-\u003efindSuggestions(request());\n$suggestions = RouteHints::findSuggestions(request());\n```\n\n## Responses\n\n| Request Type | Response |\n|--------------|----------|\n| **HTML** | Default Laravel 404 view with clickable suggestions |\n| **JSON** | `{\"suggestions\": [{\"url\": \"http://app.test/users\"}]}` |\n| **Auto-redirect** | Direct redirect when similarity \u003e threshold |\n\n## Auto-Redirect Setup\n\n\u003e **Required for session-based auto-redirect**\n\nAdd to `bootstrap/app.php`:\n```php\n-\u003ewithMiddleware(function (Middleware $middleware): void {\n    $middleware-\u003eprepend(\\Illuminate\\Session\\Middleware\\StartSession::class);\n})\n\n// Or running this command, mentioned blow in the docs\n// php artisan route-hints:setup-session\n```\n\n**Auto-redirect Data:**\n```php\n// Query method adds URL parameters:\n// /users?route_corrected_from=%2Fuser\u0026similarity=90.5\u0026route_name=users.index\n\n// Session method stores structured data:\nsession('route_hints_correction') = [\n    'original_path' =\u003e '/user',\n    'corrected_path' =\u003e '/users', \n    'similarity_percentage' =\u003e 90.5,\n    'route_name' =\u003e 'users.index',\n    'corrected_at' =\u003e '2024-01-15T...'\n];\n```\n\n## Configuration\n\n```bash\nphp artisan vendor:publish --tag=route-hints-config\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eAll Settings\u003c/strong\u003e\u003c/summary\u003e\n\n| Setting | Default | Description |\n|---------|---------|-------------|\n| `enabled` | `true` | Enable/disable route hints |\n| `max_distance` | `5` | Levenshtein distance limit |\n| `max_suggestions` | `3` | How many to show |\n| `default_discoverable` | `true` | Routes discoverable by default |\n| `excluded_patterns` | `[]` | Never suggest these routes |\n| `cache_ttl` | `3600` | Cache discoverable routes (seconds) |\n| `show_similarity_percentage` | `false` | Show similarity % in responses |\n| `show_route_names_json` | `false` | Include route names in JSON |\n| `show_route_names_view` | `false` | Show route names in HTML |\n| `auto_redirect.enabled` | `false` | Auto-redirect feature |\n| `auto_redirect.threshold` | `80` | Similarity % needed for redirect |\n| `auto_redirect.method` | `session` | How to pass correction info |\n| `auto_redirect.query_param` | `route_corrected_from` | Query parameter name |\n| `auto_redirect.session_key` | `route_hints_correction` | Session key name |\n\n\u003c/details\u003e\n\n## Commands\n\n```bash\nphp artisan route-hints:analyze [path]    # Test route suggestions for any path\nphp artisan route-hints:cache build       # Build route cache for performance\nphp artisan route-hints:cache status      # Check cache status and info\nphp artisan route-hints:cache clear       # Clear route cache\nphp artisan route-hints:setup-session     # Configure auto-redirect session\n```\n\n## Examples\n\n| User Types | Gets Suggested | Why |\n|------------|----------------|-----|\n| `/user` | `/users` | Typo correction |\n| `/dashbord` | `/dashboard` | Spelling mistake |\n| `/home` | `/dashboard` | Custom hint |\n| `/product-categories` | `/categories/electronics` | Parameterized with default |\n\n## Testing\n\nThe package includes a comprehensive test suite:\n```bash\ncomposer test\n```\n\n## Laravel Version Compatibility\n\n| Laravel Version | Package Version |\n|-----------------|-----------------|\n| 11.x            | 1.x             |\n| 12.x            | 1.x             |\n\n## Security\n\nIf you discover any security issues, please email soliman.benhalim@gmail.com instead of using the issue tracker.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsulimanbenhalim%2Froute-hints","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsulimanbenhalim%2Froute-hints","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsulimanbenhalim%2Froute-hints/lists"}