VS.PHP Brings PHP Coding Power to Visual Studio - ' Beyond the Editor ' (
Page 3 of 4 )
Intelli-sense, PHPDoc Support, and Code Outlining
One thing that makes .NET coding such a breeze in Visual Studio is the abiltity to view a class's properties and methods with the aid of Intelli-Sense. As you type, the Visual Studio IDE automatically displays an object variable's properties and methods. VS.PHP adapts this capability to PHP coding, and it's just as compelling.
ADVERTISEMENT
I defined some simple classes in a PHP file, then began writing code with them. VS.PHP identified the object variable that interested me by alphabetic sort in an inline drop-down, just as Visual Studio would if I were coding in C# or VB. Also, once I entered the PHP class delimiter characters ->, VS.PHP displayed all the fields and methods associated with the given class.
VS.PHP does a good job of providing automated commenting by integrating the PHPDoc engine into the development environment. PHPDoc is similar to JavaDoc and behaviorally similar to the automatic comment capabilities that Visual Studio uses for C# in Visual Studio 2003 and for VB and C# in Visual Studio 2005. Once I entered the beginning and end code block characters, VS.PHP had the smarts To provide PHPDoc keywords for selection. Then, once the comment was completed, it showed automatically as a Intelli-Sense descriptor for the method as I was writing code.
It took me a while to get the hang of PHPDoc commenting. The VS.PHP Web site has a number of Flash tutorials that demonstrate how to use it. Fortunately, using PHPDoc was one of those tutorials.
A key feature in Visual Studio is code outline. The ability to expand and collapse areas of code in a code window brings a lot of power and discipline to the coding experience. In .NET you use #region ... #endregion tags to define blocks of collapsing code. VS.PHP uses a different set of characters to define code blocks, but the effect is the same.
Just as with the PHPDoc feature, I found the on-line tutorials very useful in terms of getting code outlining to happen, which is a good thing. I am a bit embarrassed to report that I did not get it working right off the bat. It turns out the commenting characters are very picky, in that a space must be in place between characters and the outline node label. I did not recall seeing this fact mentioned in the tutorial. So I had an interesting half hour trying to figure this out.
VS.PHP provides access to a PHP manual and a PEAR manual by way of the Visual Studio help system, but they don't install automatically. You'll need to do a separate download and setup. But, once downloaded, they integrate easily into the Visual Studio help system as part of the installation process.
The help files are the standard on line help text created and used by the PHP and PEAR open source community. The files are formatted in HTML but do not conform to Microsoft's standard for documentation under Visual Studio .NET.