If you’re coding Laravel with VS Code, extensions are the most important factor that we need to install before starting the project.
Following are some of the best VS Code extensions for Laravel developers. These extensions will help you boost your productivity and ease your development.
1. Laravel Blade Snippet
This extension adds the syntax highlight which supports your VS Code.
Some key features of the extension:
- Blade syntax highlight.
- Blade snippets.
- Blade formatting.
- Emmet works in blade template.
To change the setting of Laravel Blade Snippet, go to Preferences and select Settings, then config in JSON file like the following
"emmet.triggerExpansionOnTab": true, "blade.format.enable": true, |
There are some syntaxes that Laravel Blade Snippet supports:
Trigger | Snippet |
b:php |
@php |
b:section |
@section // code @endsection |
b:include | @include(...) |
b:if |
@if (condition) // code @endif |
b:if-else |
@if (condition) // code @else // code @endif |
b:for |
@for (...) // code @endfor |
b:foreach |
@foreach (...) // code @endforeach |
2. Laravel Extra Intellisense
This extension supports autocomplete these features:
- Route names and route parameters.
- Views and variables.
- Configs.
- Translations and translation parameters.
- Laravel mix function.
- Validations rules.
- View sections and stacks.
- Env.
- Route Middlewares.
- Asset.
- Blade directive.
It helps us find the name of that config easily so that we don’t need to search in the directory tree. We only enter the key that we remember and this extension will remind us of another.
3. Laravel goto view
This is a simple extension. It can help you quickly jump to another file view, no matter where you are.
If you want to jump to another, we use the keystrokes “Ctrl + Click” or “Alt + Click”. Besides that, in case you want to customize more extensions, you can go to Preferences > Settings > Extensions/Laravel goto view configuration, and then add the extension that you want to customize. Here is the configuration JSON:
"laravel_goto_view.extensions": [
".blade.php",
".vue",
]
|
4. Laravel goto Controller
Finding a controller can be difficult when your application grows with a number of different controllers. Then, using this extension will help you reduce the time spent searching, you can quickly jump to the controller from the route config file without having to find the exact controller name.
The usage is the same as keystrokes in the Laravel goto view to jump to the respective controller file from the routes file.
Conclusion
These extensions will help you to boost productivity. It helps us save a lot of time and make the development project easier. Thus, using extensions in a project is always useful.
If you are excited about all the mentioned extensions above, you can take a look at the Laravel Extension Pack for Visual Studio Code. If you are interested in more extensions, I suggest you try these extensions: Laravel Blade Spacer, Laravel Artisan, Laravel Model Snippets, PHP Intelephense, PHP Constructor, etc.
Reference:
10+ Best VS Code Laravel Extensions For Developers - ThemeSelection
Image source:
Laravel Extra Intellisense - Visual Studio Marketplace