VSCode for PHP and Laravel

This post should help you setup Visual Studio Code to use for PHP and Laravel development. It it a solid base configuration that can be expanded upon using additional workspace specific configurations. I will cover the best extensions to use as well as some helpful configuration settings and external tools.

Let’s get started with the most important extensions!

Intelephense

This is the most important extension to install for PHP support. It provides a fast language server that adds code completion, go to definition, formatting, and more. You can also purchase a license at Intelephense, which I highly recommend. It adds some additional features like renaming symbols and other code actions.

Once installed, disable the built-in PHP features so Intelephense is used instead:

Disable built-in PHP settings

Disable built-in PHP settings

If a license was purchased, use cmd+shift+p to bring up the Command Palette and search for “Enter licence key”.

For the most part, the default settings are fine for Intelephense. At a workspace level, setting the document path and PHP version can be helpful if working on multiple PHP projects and frameworks.

Read More