Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

VS Code for PHP Development

DZone's Guide to

VS Code for PHP Development

When we think about the VS Code IDE, 'PHP development' probably isn't the first thing that springs to mind. But maybe it should. Read on for some reasons why.

· Web Dev Zone ·
Free Resource

Jumpstart your Angular applications with Indigo.Design, a unified platform for visual design, UX prototyping, code generation, and app development.

Although most of my work time is spent on ASP.NET and SharePoint development, I also have some PHP projects. I have my own favorite thin tooling for PHP but I decided to give Visual Studio Code (VS Code) a try with one of the projects. This blog post describes what I have in my dev box and what my first impressions are of using VS Code for PHP development.

Why VS Code?

VS Code is not an IDE like Visual Studio. It is also not a simple code editor with a few commands and syntax highlighting. It sits somewhere in the middle, making it a simple yet powerful tool thanks to the fact that it supports extensions. The main reasons why I considered trying out VS Code for PHP development are:

  • It’s free and cross-platform (Linux and Apple are also supported).
  • It’s is way smaller than Eclipse, NetBeans, and other big IDEs.
  • It’s is more advanced than Notepad++ and other simple code editors.
  • It’s is well supported by Microsoft and the developer community.
  • There are many extensions available for different languages and file formats.

Those who want to get the newest features first and play with raw bits and bytes of VS Code can download the VS Code Insiders version. It is installed side-by-side with stable versions and they don’t conflict with each other.

PHP Tooling on VS Code

I use IIS to build PHP sites on my dev box so I don’t have to keep editors and other development tools running when showing something to a customer from my machine. I have PHP 5 and PHP 7 installed and configured for IIS, meaning that I don’t need to run PHP directly from VS Code. The following screenshot shows the VS Code editor and file explorer. Notice how SQL is also highlighted in the string.

PHP on VS Code

I installed PHP IntelliSense extension by Felix Backer to have advanced syntax highlighting for PHP. Besides syntax highlighting, this extension has the following useful features:

  • Code completion
  • Signature help
  • Workspace symbol search
  • Find all references
  • Go to definition
  • Hover

I don’t have big or complex PHP developments going on and PHP IntelliSense plugin is currently enough for me.

Debugging PHP Code

Sooner or later my demands will grow and it’s possible I'll want to run PHP code on a debugger so I can see what’s going on exactly. For this, I found PHP Debug Adapter by Felix Backer (again!). Take a look at this short GIF-video from the plugin's GitHub repository to get a better understanding of what his debugger can do.

PHP debugging on VS Code

Looks impressive considering that something like this is running on some thin code editor.

My Experiences Thus Far

I have used VS Code for PHP development for a few weeks and here are my first impressions:

  • VS Code is stable and fast.
  • PHP development is well supported by different plugins.
  • Code navigation is almost as convenient as it is in Visual Studio.
  • VS Code has a clean and simple UI with almost no clutter.
  • Git tools work well but a more informative UI would be better (not a big issue).

Those who doubt if VS Code is really good for PHP development should definitely try it out and it doesn’t matter what platform you are using. I’m happy with VS Code and PHP!

Take a look at an Indigo.Design sample application to learn more about how apps are created with design to code software.

Topics:
ide ,vs code ,php ,web dev ,code editor

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}