10 Awesome VS Code Extensions for PHP/Laravel Developers

Benson Arafat
5 min readJul 16, 2022

--

We all know how text editors are very important to us when we code, for everyone who is getting started with Laravel.

Below, are my list of the Top 10 extensions I recommend for all Laravel/PHP developers, which will help you expand your productivity.

1. Laravel Artisan

We all use the VS Code terminal to run artisan commands and that is great but using the Laravel Artisan Extension you can run the artisan commands from within VS Code directly.

Some of the main features are:

  • Make files (Controllers, Migrations, Models, etc)
  • Run Custom Commands
  • Manage the database
  • Clear Caches
  • Generate Keys
  • View all routes
  • Start/stop a local PHP server for test purposes

Laravel Artisan on VS Code

2. Laravel Blade Snippets

Laravel Blade Snippets extensions add syntax highlight support

Some of the features are

  • Blade syntax highlight
  • Blade snippets
  • Emmet works in blade template
  • Blade formatting

After that is done, there is some other stuff to be done for the extension to work properly. Go to File -> Preferences -> Settings and add this to your settings.json

"emmet.triggerExpansionOnTab": true, // enable tab to expanse emmet tags
"blade.format.enable": true, // if you would like to enable blade format
"[blade]": {
"editor.autoClosingBrackets": "always"
},

For more information on how to use the Laravel Blade Snippets make sure to your check here documentation here.

Laravel Blade Snippets on VS Code

3. Laravel Blade Spacer

Laravel blade spacer helps to automatically add spacing to blade templating markers.

Supports the following tags

  • {{ }}
  • {!! !!}
  • {{-- --}}

Laravel Blade Spacer

4. Laravel Extra Intellisense

Laravel Extra Intellisense provides Laravel route, views and autocompletes for VS Code

Some of the autocomplete features are

You can also check the documentation on how to set it up.

Laravel Extra Intellisense

5. Laravel goto view

This is one of my favourite extensions when developing in Laravel, this extension helps you go to a particular view when clicked.

How to use this extension

You can use Ctrl or Alt + click to jump to the first matched Blade View file

Laravel goto View on VS Code

6. DotENV

DotENV extensions helps a lot in VS Code .env sytnax highlighting

You can check DotENV documentation for more information.

DotENV on VS Code

7. Laravel Snippets

Laravel snippets extension for VS Code Support Laravel 5 and above, this snippet provides prefix follows Laravel Facades for example Route:: Request::

Support Snippets Prefix

  • Auth
  • Broadcast
  • Cache
  • Config
  • Console
  • Cookie

Browse the documentation for more about the Laravel Snippets extensions

8. Laravel goto controller

As your application grows, the number of your Controllers grows as well, so at some point, you might end up with hundreds of controllers. Hance finding your way around might get tedious.

This is the exact problem that the Laravel-goto-controller VScode extension solves.

The extension allows you to press Alt + click on the name of the controller in your routes file, and it will navigate you from the route to the respective controller file:

For more information, make sure to check the documentation here:

VSCode extension for Laravel

9. PHP Namespace Resolver

PHP Namespace Resolver can import and expand your class. You can also sort your imported classes by line or in alphabetical order.

For more details, you can check the online documentation on more configurations

PHP Namespace Resolver on VS Code

10. PHP Formatter

After installing as an extension with Visual Studio Code, this extension automatically formats your PHP code, in accordance with PSR-0, PSR-1, PSR-2 or Symfony style conventions.

Some of the features are:

  • Format current selection only, or the whole file.
  • Trigger formatting with custom keybindings or actions.
  • Supports formatting on save.
  • Supports adjustable level (i.e. PSR2) and fixers.
  • Can be configured to support other file extensions than PHP as well, i.e. “.inc” files.
  • Supports different PHP-CS-Fixer installation methods, i.e. Composer vs manual installation.

For more on how to set up and use the PHP formatter on VS Code, you can go through the online documentation

PHP Formatter on VS Code

Conclusion

If you like all those extensions, you can take a look at the Laravel Extension Pack on VS Code, where you could get all of the mentioned extensions as 1 bundle!

The only extension not included in the pack is the Laravel Blade Spacer, so make sure to install it separately!

I hope that this helps!

--

--