PHP Tools for Visual Studio

This is an old revision of this page, as edited by Fernanda Liendo (talk | contribs) at 12:50, 20 May 2019. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

PHP Tools for Visual Studio is a commercial extension for Microsoft Visual Studio[1][2][3], which adds the ability to work with PHP programming language. PHP Tools integration allows software developers to create and manage PHP projects (computer programs, web sites, web services and web apps), debug and maintain the source code.

PHP Tools for Visual Studio
Developer(s)DEVSENSE s.r.o.
Initial releaseMarch 2012; 13 years ago (2012-03)
Stable release
1.30.11199 / May 10, 2019; 6 years ago (2019-05-10)
Written inC#
Operating systemMicrosoft Windows
Available inEnglish, Spanish, German and others (fr, ja, pt-br, ro, ru, tr, zh)
LicenseProprietary
Websitewww.devsense.com


Features

All of the features in Visual Studio can be used with PHP Tools, for instance:

  • IntelliSense
  • Navigation
  • Code Formatting
  • Syntax Highlighting
  • Refactoring
  • Debugging

Code Editor

PHP Tools includes a code editor that supports syntax highlighting and code completion to make the PHP code readable. The editor reuses other language editors from Visual Studio such as HTML, CSS, JavaScript.

The code editor makes use of PHP 5 and PHP 7 type hints and PHPDoc comments. Without specifying the type of information, it analyses values and expressions in order to estimate the resulting type. Then, based on the analysis, the app predicts when an expression will cause a run-time error. These errors usually indicate a typo, a missing use or an invalid missing namespace name in PHPDoc comment.

Debugger

The majority of features of the integrated debugger of Visual Studio are supported by PHP Tools. The debugger consists of two main components: the front-end component is the one responsible for visually communicating with the user, and the back-end component is hooked directly to the PHP core. PHP Tools for Visual Studio provides the front-end component and communicates with the back-end provided by the Xdebug extension. The communication uses the DBGp debugging protocol. Equally as in Visual Studio[4], the debugger allows setting breakpoints to stop execution at a certain position in the code and watches which monitor values of variables when the program is paused. Breakpoints can be conditional, meaning that they broke the code when a given PHP expression is evaluated as true. Also, they can break when a given exception is thrown or by default, the program breaks when fatal error happens, that is, any exception that prevents the program from continuing. Once broken into the debugger code, it can be executed one line at a time: this is called stepping. The step commands include Step Into, Step Over, and Step Out[5]. When the program is broken, if the mouse hovers over the variable, the current value is displayed in a tooltip, where it can be modified. The debugger allows developers to change the state of the executed program by editing the values of variables, so alternative execution paths can be examined.

PHP Tools also has a version for extending the free[6] Visual Studio Code (it's called PHP Tools for VS Code) for PHP language. This plugin allows editing, code validation, refactoring, debugging and testing, among others in Microsoft Visual Studio Code.

References