VS Code for PHP 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 a try to Visual Studio Code (VS Code) with one of the projects. This blog post describes what I have in my dev box and what are my first impressions using VS Code for PHP development.

Why VS Code?

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

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

Those who want to get newest features first and play with raw bits and bytes of VS Code can download 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 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 VS Code editor and file explorer. Notice how SQL is also highlighted in 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 want to run PHP code on 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 plugin GitHub repository to get better understanding what his debugger can do.

PHP debugging on VS Code

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

My experiences this far

I have used VS Code for PHP development for 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 same convenient as in Visual Studio
  • VS Code has clean and simple UI with almost no clutter
  • Git tools work well but more informative UI would be better (not a big issue)

Those who doubt if VS Code is really go-go 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!

Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

    One thought on “VS Code for PHP development

    • June 7, 2018 at 9:30 am
      Permalink

      These tools are developed to account for an ideal Integrated Development Environment (IDE) where web developers can work more efficiently to build innovative, engaging and feature-rich websites.

    Leave a Reply

    Your email address will not be published. Required fields are marked *