March 26, 2009

PHP IDEs

Filed under: .Net,C++,PHP,Programming — pj @ 11:06 pm

What is an Integrated Development Environment (IDE)? For sure “IDE” means different things to different programmers. Some probably think an integrated GUI form editor or WYSIWYG HTML editor is critical. Others may think that the most important parts of an IDE are the text editor and code browser. Others still judge IDEs by their code “refactoring” tools.

For me, the IDE goes back to the days of Borland’s Turbo Pascal and Turbo C. They didn’t have GUIs much less GUI form editors, HTML wasn’t yet invented and I don’t remember the text editor being anything special. What turned them into IDEs was the super efficient work flow… A typical “Hello World” program was mostly a matter of typing in some code and pressing the Run key. If you wanted to debug, you would set your breakpoints right in the editor, then press the Debug key to start your program under the integrated debugger. When your program expanded to more than one file, IDEs had simple project facilities that did a good job of bridging the gap between “Hello World” and tools for large projects like “make” and “nmake”. Later, when the GUI APIs got so big that nobody could keep them all their head, integrated documentation became critical to a smooth workflow. For better or worse, I’ve become addicted to code completion. It doesn’t work as well for dynamic languages like PHP, but some code completion is better than none.

So, when I think IDE, I think of an all purpose application that makes a programmer’s day-to-day workflow smooth and efficient… I find that anything I can do that cuts down my “cycle” time improves my productivity (and my mood).

Every since the days of Microsoft C 6, Microsoft has always had the best IDEs for C/C++ and Windows development. Their documentation is better and better integrated, their compilers are way, way faster and the general work flow is always the smoothest. Visual Studio continues this trend for C/C++ and now C# development – it sure is easy to crank up a new C# web application and start debugging.

As as web host, I end up working on a lot of different sites. These days, there is a lot of PHP code out there and I end up spending a fair amount of time working on PHP projects. For most my really big projects, I typically use C# and Asp.Net, so I have Visual Studio handy. With a few registry tweaks to syntax highly PHP code, Visual Studio works OK as a text editor for PHP, but I wouldn’t call it a true PHP IDE. For one thing, there is no integrated debugging support. You can kind of get project file support (PHP files can be listed), but the only integrated documentation is for HTML and JavaScript (and sadly, the Microsoft documentation on these frequently referenced topics is IE centric).

So, several times, I’ve set out on a mission to find a IDE for PHP programming. Last time around, I gave up and stuck it out using Visual Studio as a text editor. After this last round of reviews, I ended up buying NuSphere’s PhpED.

When you are in the world of “free” software, it is tempting to stick only to “free” tools. However, in the case of IDEs, I just couldn’t find a free one that worked well enough to be better than Visual Studio.

One area where PHP needs a lot of work is support for debugging. The basics are there, but having to fiddle with various debugging DLLs is a hassle – debugging information has been standard for binary programs for years – how hard could it be to figure out a standard debugging API for IDEs to use?  Having to use query strings to initiate a debugging session is a serious design mistake. With all the rewriting and other things going on, fiddling with URLs just doesn’t make sense. Visual Studio is able to attach a debugger to server code in just about any situation – PHP and its IDEs should make this as easy.

The ability to automatically reformatting HTML in both blocks and full pages is very handy… plenty of tools (like content management systems) make a real mess of HTML. And, for better or worse, you end up using some of these tools over and over so it’s not like you can fix the code just once and be done with it.

Below are some notes I made as I tried out various PHP IDEs:

Eclipse PHP

No cost and open source

Cross-platform (Java)

Attractive

Amazingly slow and memory hungry – based on Java and requires a Java Runtime to be installed.

Integrated PHP reference uses the php.net web site so, it requires Internet access and is slow.

No integrated CSS, HTML, JavaScript or DOM reference

No WYSIWYG HTML editor, no integrated page preview, either

HTML reformat is weak and not customizable

Go to definition doesn’t work reliably

Code completion doesn’t work reliably

Code completion doesn’t work in CSS files.

HTML code completion uses upper case for tags and attributes.

Subversion integration is slow and shows incorrect status

Crashes frequently

Debugger worked for a simple page, but did not work in a real project

Komodo IDE

Attractive 

Cross-platform – interesting choice of Firefox engine

Reasonable performance and memory usage

Subversion integration is quick and accurate

Once configured, PHP syntax checking is very handy

No WYSIWYG HTML editor, but the integrated page preview is well done

Go to definition doesn’t work reliably

Code completion doesn’t work reliable (does not seem to follow include paths).

No integrated PHP, CSS, HTML, JavaScript, DOM or MySQL reference

Copy and paste of files in Projects tree fails with no error message

Deluxe syntax PHP + HTML syntax highlighting.

View unsaved changes off File menus is a great idea! The integration of this feature with the recovery of unsaved changes after a crash is nice, too.

Extremely annoying rendering bugs in the text editor

Code completion for CSS and HTML

CSS code completion is not very good. For example, once you type “margin:”, you get a drop list of choices instead of a description of the arguments for the margin style.

HTML code completion is annoying because it defaults to upper-case tags (is anyone still NOT using xhtml for new code?)  and does a poor job of suggesting closing tag (typing “</” does not give a drop list of closing tags).

PHPEdit

Attractive

Reasonable performance and memory usage

Subversion integration does not work out of the box.

Integrated PHP and MySQL reference is nice, no integrated CSS, HTML, JavaScript or DOM reference.

The ultra-deluxe syntax highlighting changes the highlighting rules depending on where the caret is placed – very handy for files with integrated HTML, PHP, CSS and JavaScript!.

No code reformat for any language other than PHP.

No code completion for any language other than PHP (CSS and HTML would be nice).

Go to definition (“Jump to declaration”) doesn’t work across files.

Cannot right click to open a file via a simple require() declaration.

No heroics to resolve PHP include paths for code completion.

DB Explorer is an interesting idea, but I think the most important thing about a database to a programmer is the column definitions (names, types, lengths) and, other than seeing the column names in the DB Explorer tree, there is no way see the column definitions for a table. Manually inputing a “show columns from” query into the SQL tab didn’t work – you end up with an “Invalid SELECT statement” error message in a message box.

Non-standard Alt+Tab behavior is not very useful.

PhpED

The debugger actually works! But, it’s a lot more hassle than it should be.

CSS code completion is OK, but Visual Studio is still the best.

PHP code completion is reasonable and follows include paths in some cases.

Integrated documentation for CVS, CSS, HTML, JavaScript, MySQL, PHP, PostgreSQL  and Smarty – very nice!

The project system works OK for PHP projects, but it is cumbersome and has odd limitations (you can’t copy and paste files and folders, for example). 

Non-standard Alt+Tab behavior is not very useful.

No Subversion integration

No integrated code reformatting (help provides a good explanation of how to integrate 3rd party tools, but these don’t seem to work well, either).

One of the real selling

The ability to edit files via FTP or SSH file transfer is nice.

Integrated support for SSH terminals is nice (but why, oh why is copy and paste so difficult?)

Other Suggestions

A lot of people use Dreamweaver to edit PHP code. I guess if you come from the design world, this makes sense. Syntax highlighting for PHP is pretty poor, but I will say that Dreamweaver has the best support for code reformatting.

Notepad++ has a good syntax highlighting of many languages and there are add-ons to support FTP and integrated spell check.

Leave a Reply

Powered by Teztech