VSCode extensions for Laravel and PHP development

vscode-extensions-laravel-development-header-1.png

In this article we are going to look at how to make VSCode ready for Laravel/PHP Development. If we organized a poll to determine what text editors found most favorable for development purposes, VSCode will probably be one of the top ones. VSCode is an open-source text-editor built by Microsoft for developers. Out of the \[…\]

Introduction

In this article we are going to look at how to make VSCode ready for Laravel/PHP Development.

If we organized a poll to determine what text editors found most favorable for development purposes, VSCode will probably be one of the top ones.

VSCode is an open-source text-editor built by Microsoft for developers. Out of the box, VSCode has a lot of desirable features but sometimes, we need to tweak it to our specification.

Requirements

  • VSCode installed on your machine. Download here.
  • Basic knowledge of the Laravel PHP framework.

Extensions, extensions, extensions

One of the best parts of VSCode has to be the plugin system. This allows for developers to make add-ons which they wished came with VSCode and upload them to the market place for other developers to use

Advanced New File

advanced new file

When building applications, we are going to be making a lot of new files and this extension is here for just that. Instead of having to open the file explorer to create new files, by clicking Ctrl + Alt + N you trigger the prompt that lets you specify the file path of the file you want to create and the name of the file itself. This saves you a lot of time in the long run when you get used to it.

Features

  • Fuzzy-matching autocomplete to create new file relative to existing path.
  • Create new directories while creating a new file.
  • Create a directory instead of a file by suffixing the file path with /, as in directory/ to create the directory.
  • Ignores gitignored and workspace files.exclude settings.
  • Additional option of adding advancedNewFile.exclude settings to workspace settings just like native files.exclude, except it explicitly affects the AdvancedNewFile plugin only.
  • Control the order of top convenient options (“last selection”, “current file”, etc) via config setting advancedNewFile.``convenienceOptions.

Extension in action:

advanced new file in action

File Utils

file utils

This extension will mainly come in handy when you want to rename, duplicate, move or delete files and directories. Here, you no longer have to open the file explorer in the sidebar to perform these actions.

To use the File Utils , you just need to run Ctrl + P and then type File and the options will pop-up for you to decide what you want to do with the file in question.

Extension in action:

file utils in action

PHP Intelephense

intelephense

Intelephense offers fast code completion with detailed suggestions and rapid workspace-wide go to definition support. This extension saves you the stress of having to remember every little bit of what you are trying to type as the intellisense feature works really well out of the box.

Features

  • Fast camel/underscore case code completion (IntelliSense), offering detailed suggestions for document, workspace and built-in symbols and keywords.
  • Detailed signature (parameter) help for document, workspace and built-in constructors, methods, and functions.
  • Rapid workspace-wide go to definition support.
  • Workspace-wide find all references.
  • Fast camel/underscore case workspace symbol search.
  • Full document symbol search.
  • Multiple parse error diagnostics for open files via an error tolerant parser.
  • Lossless PSR-2 compatible document and range formatting.
  • Convenient command to add use declarations and condense referenced names.
  • HTML request forwarding allowing for a full HTML/Javascript/CSS/PHP development experience.

Extension in action:

intelephense in action

Laravel 5 Snippets

laravel 5 snippets

This package gives Laravel snippets for us to use in VSCode when building our applications. Instead of typing out longer Laravel commands, you just use prefixes like: Auth, Cache, Config, Route, Mail, View etc. More prefixes are shown on the view page of the extension.

Extension in action:

laravel 5 snippets in action

Laravel Blade Snippets

blade snippets

Laravel Blade Snippets offers blade snippets and blade syntax highlight support for VSCode. It consists of a set of triggers that, when typed, give the respective blade snippets. This also makes your blade templating easier and faster.

Features

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

Extension in action

blade snippets in action

Laravel Artisan

laravel artisan

The Laravel Artisan extension makes running artisan commands a breeze when using Laravel. To use it, you just need to trigger the VSCode command palette by pressing Ctrl+Shift+P and then typing Artisan and the artisan commands will show up to be executed.

Extension in action

laravel artisan in action

Vim

vim

Most developers dread Vim before they actually get a hang of it (I was scared too, you can get lost easily). Once you get a hang of Vim, you’ll definitely find your life a lot easier as traversing and editing your files become a lot faster for you.

If you’re looking to get started with vim, launch your terminal and run the command:

1vimtutor

Once you run through the tutorial, you’ll definitely have a fun time using vim.

Align

align

Ever tried asking for help and someone looks at your code and is like “ah! Your code is ugly”. Everyone loves beautiful code and this extension helps you to align your code. Don’t be that person with misaligned code blocks.

Usage: Highlight code block and enter Ctrl+Alt+a or Ctrl+cmd+a if you’re a Mac user.

Conclusion

These extensions have been shown to be useful when developing Laravel/PHP applications.