Visual Studio Code - Top 5 Extensions for PHP

| By Maina Wycliffe | | | PHP

Visual Studio Code is one of the best free text editors out there. Right out of the box, Visual Studio Code offers basic PHP support but nothing more than that. To enjoy a fruitful PHP development, you need to install PHP extensions. Today, I am going to highlight 5 extensions you might want to consider. If you would like to try out Visual Studio Code, you can download it here.

PHPCS (PHP CodeSniffer) – Ioannis Kappas

This extension offers an interface for PHP CodeSniffer. PHP CodeSniffer scans the PHP files in your workspace to detect and offer suggestions and fixes for violations of a defined set of PHP standards. It’s an excellent extension that will ensure you strictly follow standard for PHP.

You can learn more about PHP standard here. For you to use this extension, you need to install PHP CodeSniffer globally into your development machine. You can install PHP CodeSniffer using either PEAR or Composer as shown below.

// PEAR
pear install PHP_CodeSniffer

// Composer:
composer require --dev squizlabs/php_codesniffer

To install PHPCS, press F1 on Visual Studio and type the following command:

ext install phpcs

You can learn more about this extension here.

PHP Intellisense Crane – Hvy Industries

Visual Studio Code - Top 5 Extensions for PHP To use the creator’s words, PHP Intellisense Crane is a productivity enhancement extension for Visual Studio Code that provides code-completion for PHP. It has zero dependencies and largely works with projects of any size. The extension is active in development and you can raise issues and make feature suggestion on GitHub. This extension offers the following features: Code Completion, Go To and Peek Definition on classes, interfaces and traits and document workspace symbol provides. To install PHP Intellisense Crane, press F1 on Visual Studio Code, and type the command below.

ext install crane

Once installation is complete, wait for it to parse all PHP files in your workspace. You will see a progress bar at the status bar.

You can learn more about PHP Intellisense Crane here.

PHP Intelephense – Ben Mewburn

This is one of the best PHP Extension I have ever used. It provides a tonne of useful features without affecting negatively the performance of Visual Studio Code. It also has no external dependencies. It has the following 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.

To install this extension, press F1 and type in the command below:

ext install bmewburn.vscode-intelephense-client

You can learn more about this extension here.

PHP Intellisense – Felix Becker

Just like the name suggests, it offers Intellisense autocompletion for PHP. This extension depends on PHP Language Server to work. The extension just provides an interface to the PHP Language Server. To use this extension, first install the PHP Language Server using composer as show below:

composer require felixfbecker/language-server

If you have multiple projects, you can install PHP Language Server globally as follows:

composer global require felixfbecker/language-server

You also need to have PHP7 installed in your system. Then go ahead and install the extension on Visual Studio Code. Press F1 and type in the following command:

ext install php-intellisense

You can learn more about the extension here.

PHP Debug – Felix Becker

Visual Studio Code - Top 5 Extensions for PHP

This extension is an adapter for XDebug extension for PHP. XDebug is an extension for PHP that assists with debugging and development of PHP projects. To use this application, you need to install XDebug and PHP into your system.

You can follow the instruction found in the extension page here. To install this extension, press F1 and type in the command below.

ext install php-debug.
5 Visual Studio Code Extensions for Angular

Visual Studio Code or VSCode is one of the best text editors out there. It is feature rich out of the box and has a lot of extensions which …

Read More
PHP: Frameworks vs Microframeworks

Introduction A PHP Framework in simple terms is a platform used by developers to create web applications – obviously made by PHP. They help …

Read More

Comments