Laravel Wayfinder
A powerful VS Code extension that enhances navigation within Laravel projects, providing seamless bidirectional jumping between routes, controllers, views, and Blade directives. It integrates deeply with Laravel's structure to boost productivity for developers working on Laravel applications.
Features
Laravel Wayfinder offers a comprehensive set of navigation features designed to streamline Laravel development:
Core Navigation Commands
- Jump to Controller (
laravel-wayfinder.jumpToController): From a route definition, jump directly to the corresponding controller method.
- Jump to View (
laravel-wayfinder.jumpToView): From a controller method, jump to the view file being returned.
- Jump to Route (
laravel-wayfinder.jumpToRoute): From a controller method, jump back to the route definition.
- Jump to Directive (
laravel-wayfinder.jumpToDirective): From Blade directives like @include, @component, or @extends, jump to the referenced view file.
- Jump to Controller from View (
laravel-wayfinder.jumpToControllerFromView): From a view file, jump to the controller method that renders it.
Symbol Search Integration
- Document Symbols: Provides symbols for routes in route files, allowing quick navigation via VS Code's symbol outline.
- Workspace Symbols: Search across routes, controllers, and views using VS Code's symbol search (
Ctrl+Shift+O or Cmd+Shift+O).
- Auto-completion: Intelligent completion for view names when typing
return view(' in PHP files.
Advanced Features
- Bidirectional Navigation: Seamlessly move between related Laravel components (routes ↔ controllers ↔ views).
- Caching: Built-in caching for route and view indexes to improve performance on large projects.
- Customizable Paths: Support for non-standard Laravel directory structures.
- Multi-version Support: Compatible with various Laravel versions (6.x, 7.x, 8.x, 9.x, 10.x, 11.x).
Installation
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X or Cmd+Shift+X)
- Search for "Laravel Wayfinder"
- Click Install
- Reload VS Code if prompted
Alternatively, you can install via the command line:
code --install-extension laravel-wayfinder
Setup for Laravel Projects
Laravel Wayfinder works out-of-the-box with standard Laravel projects. For custom setups, you may need to adjust configuration settings.
Requirements
- VS Code 1.74.0 or higher
- A Laravel project (version 6.x or later recommended)
Automatic Detection
The extension automatically detects Laravel projects by looking for:
routes/ directory
app/Http/Controllers/ directory
resources/views/ directory
composer.json with Laravel dependency
Initial Setup
- Open your Laravel project in VS Code
- The extension will activate automatically when you open PHP files
- Start using navigation commands via keybindings or command palette
Usage
Basic Navigation
Jumping from Route to Controller
- Open a route file (e.g.,
routes/web.php)
- Place cursor on a route definition line:
Route::get('/users', [UserController::class, 'index']);
- Use
Ctrl+Shift+J (or right-click → "Jump to Controller") to jump to UserController@index
Jumping from Controller to View
- Open a controller file (e.g.,
app/Http/Controllers/UserController.php)
- Place cursor inside a method that returns a view:
public function index()
{
return view('users.index');
}
- Use
Alt+Shift+V (or right-click → "Jump to View") to open resources/views/users/index.blade.php
Jumping from View to Controller
- Open a view file (e.g.,
resources/views/users/index.blade.php)
- Use
Alt+Shift+C (or right-click → "Jump to Controller from View")
- If multiple controllers render this view, select from the quick pick menu
Advanced Navigation
Bidirectional Navigation Tutorial
Laravel Wayfinder enables true bidirectional navigation between Laravel components:
Route → Controller → View → Controller → Route
Start in routes/web.php:
Route::get('/dashboard', [DashboardController::class, 'index']);
- Jump to Controller: Opens
DashboardController.php at index method
- Jump to View: Opens
resources/views/dashboard.blade.php
- Jump to Controller from View: Returns to
DashboardController@index
- Jump to Route: Returns to the route definition
Blade Directive Navigation
In a Blade file:
@extends('layouts.app')
@include('partials.header')
@component('components.alert')
Place cursor on any directive line and use Alt+Shift+D to jump to the referenced file.
Symbol Search Integration Tutorial
Leverage VS Code's built-in symbol search for powerful Laravel navigation:
- Searching Routes: Press
Ctrl+Shift+O and type route URIs or HTTP methods (e.g., "GET /users")
- Finding Controllers: Search for controller names or method names (e.g., "UserController index")
- Locating Views: Search for view names (e.g., "dashboard")
The extension indexes all routes, controllers, and views for fast, fuzzy-matched searching.
Keybindings
| Command |
Keybinding |
Description |
| Jump to Controller |
Ctrl+Shift+J |
Route → Controller |
| Jump to View |
Alt+Shift+V |
Controller → View |
| Jump to Directive |
Alt+Shift+D |
Blade directive → View |
| Jump to Route |
Alt+Shift+R |
Controller → Route |
| Jump to Controller from View |
Alt+Shift+C |
View → Controller |
All commands are also available in the right-click context menu when editing relevant files.
Configuration
Laravel Wayfinder is highly configurable to support various Laravel project structures. Access settings via File → Preferences → Settings → Extensions → Laravel Wayfinder.
Path Configuration
{
"laravelWayfinder.viewRoot": "resources/views",
"laravelWayfinder.routesPath": "routes",
"laravelWayfinder.controllersPath": "app/Http/Controllers",
"laravelWayfinder.modelsPath": "app/Models",
"laravelWayfinder.middlewarePath": "app/Http/Middleware"
}
Feature Toggles
{
"laravelWayfinder.enableSymbolProviders": true,
"laravelWayfinder.enableCompletions": true,
"laravelWayfinder.enableDiagnostics": false
}
{
"laravelWayfinder.cacheEnabled": true,
"laravelWayfinder.maxSearchResults": 100,
"laravelWayfinder.logLevel": "info"
}
Laravel Version Support
Set the Laravel version for optimal compatibility:
{
"laravelWayfinder.laravelVersion": "10.x"
}
Supported versions: 6.x, 7.x, 8.x, 9.x, 10.x, 11.x
Custom Directories and Extensions
For projects with custom structures:
{
"laravelWayfinder.customNamespaces": ["App\\Custom", "Vendor\\Package"],
"laravelWayfinder.additionalViewDirectories": ["resources/views-custom"],
"laravelWayfinder.customFileExtensions": [".php", ".blade.php", ".twig.php"],
"laravelWayfinder.ignorePatterns": ["vendor/**", "node_modules/**", "storage/**"]
}
Project-Specific Settings
Override global settings for specific projects:
{
"laravelWayfinder.projectSpecificSettings": {
"my-project": {
"viewRoot": "views",
"controllersPath": "src/Controllers"
}
}
}
Troubleshooting
Common Issues
Navigation Commands Not Working
- Check File Types: Ensure you're in the correct file type (PHP for controllers/routes, .blade.php for views)
- Verify Paths: Confirm your Laravel directory structure matches the configured paths
- Reload VS Code: Sometimes a reload (
Ctrl+Shift+P → "Developer: Reload Window") fixes activation issues
- Check Logs: Set
laravelWayfinder.logLevel to "debug" and check the "Laravel Wayfinder" output channel
Views Not Found
- Ensure view files end with
.blade.php
- Check
laravelWayfinder.viewRoot setting
- For components, ensure they're in
resources/views/components/
Routes Not Parsing
- Verify route syntax matches supported patterns
- Check for custom route service providers
- Ensure route files are in the configured
routesPath
- Enable caching:
"laravelWayfinder.cacheEnabled": true
- Increase
maxSearchResults if needed
- Add ignore patterns for large directories
Extension Not Activating
- Confirm VS Code version >= 1.74.0
- Check if the project has Laravel files
- Try reinstalling the extension
Debug Mode
Enable detailed logging:
{
"laravelWayfinder.logLevel": "debug"
}
View logs in VS Code's Output panel: View → Output → Laravel Wayfinder
Reset Configuration
To reset to defaults, remove Laravel Wayfinder settings from your settings.json or use:
{
"laravelWayfinder": {}
}
Laravel Version Compatibility
Laravel Wayfinder supports multiple Laravel versions with optimized parsing and features:
- Laravel 6.x - 7.x: Basic route parsing, standard directory structure
- Laravel 8.x: Enhanced with attribute-based routing support
- Laravel 9.x - 11.x: Full support including new features and syntax
Set your Laravel version in settings for best compatibility:
{
"laravelWayfinder.laravelVersion": "10.x"
}
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Development Setup
git clone https://github.com/your-repo/laravel-wayfinder.git
cd laravel-wayfinder
npm install
npm run compile
Press F5 to launch extension development host.
License
This extension is licensed under the MIT License. See LICENSE file for details.
Release Notes
0.0.1
- Initial release
- Basic navigation between routes, controllers, and views
- Symbol search integration
- Auto-completion for view names
- Configurable paths and settings
For more information or to report issues, visit the GitHub repository.
laravel-wayfinder