• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
Seven great PHP IDEscompared
 Learn more and find the one that's right for you
Level: IntermediateJack Herrington( jherr@pobox.com), Senior Software Engineer, Code Generation Network  10 Oct 2006Discover what you should expect from an integrated development environment (IDE), andcompare the cost and benefits of seven popular IDE choices.Writing an ongoing series of articles on PHP gives you a lot of insight into the world of PHPdevelopers. I've talked with many PHP programmers, and one thing that surprises me most ishow few use IDEs. Most use text editors, such as Notepad on Microsoft® Windows®, Emacs,or Vim.The text editors I mentioned (and others I didn't) are great -- I don't want to start a pointless war over which editor is better. However, no text editor really gives you much insight into your PHPcode. In particular, none views a PHP project as more than a directory of files. Let me take youinto the world of IDEs, show what you can -- or should -- expect from them, and provide sevenexamples from the most popular IDE options.What is an IDE?In short, an IDE provides a one-stop shop for your coding work. An IDE contains an editor inwhich you can edit the code, debug the code, view your code in a browser (often embedded),and check in and out of source code control. To support that functionality, an IDE has a set of features you don't find in a basic editor, such as Notepad or Vim. Again, you can extend editorsto do a lot of these things, but IDEs have all this functionality in one tidy package -- typically preconfigured:
Projects
A key distinguishing feature of an IDE is that it looks at a PHP application as a project,not just a set of files. That containing concept -- the
 project 
-- maintains extrainformation, such as the configuration of the source code control, the database settingsfor debugging purposes, and the location of certain key directories.
Debugging
Another handy feature is integrated debugging. With this functionality, you can set breakpoints in the editor at which the PHP interpreter stops during execution of thescript. From there, you can inspect the values of local variables to diagnose issues in thecode. It's a healthy alternative to sprinkling
echo
statements through your code to check values or using the error log to get the values of variables.
Code intelligence
PHP is a very regular programming language, which means that it follows simple
 
 patterns. Not only do these patterns make it easy to write, they make it easy for an IDEto inspect the code in your project. In addition, they help you while writing bydisplaying the results of their inspection. For example, if you define a class with thename
MyClass
in your project, the IDE then provides a pop-up window that includes
MyClass
as an option as soon as you type the keyword
new
. As you use the object of thattype, the IDE shows its available methods and instance variables. When you start typinga function call, the IDE helps you by displaying the available arguments. Honestly, thisis the No. 1 reason you should use an IDE and not a text editor. This type of codeintelligence can save you hours of mistyped class names, method names, and wrongarguments.
Class view
A side effect of having a code intelligence engine in the IDE is that the IDE can producea
class view
of the project. Instead of showing the files, the system can show you thedifferent classes you have defined, regardless of the file they're in. As you click theclasses, your editor is taken to that file and the selection placed on the class, method, or instance variable. It's a much nicer way of navigating around big projects.
Support for multiple languages
Each IDE covered here supports not just PHP but a collection of the related languages:JavaScript, Structured Query Language (SQL), Hypertext Markup Language (HTML),and Cascading Style Sheets (CSS). Support for HTML and CSS are often the best, because it's simpler. The support for JavaScript often comes down to syntaxhighlighting, but something is better than nothing.
Source code control
All the IDEs evaluated here support some connection to a source code control system,which allows you to maintain versions of the files in your project over time. You canmark particular versions of the files as a release, then revert to them when you want toroll out changes you've made. It's critical in team environments to use a source codecontrol system, but it's important for individuals to use one, as well. A good source codecontrol system can save you when a disk blows up or when the customer suddenly wantsthe version before last, rather than what you have today. Most of the IDEs supportConcurrent Version System (CVS) and Subversion, which are open source controlsystems. One IDE supports Perforce, a commercial source code control system.
FTP/SFTP integration
Related to source code control is the ability to use FTP for the most recent code to theserver. This is a lot easier than using an FTP client or packing up the files yourself,sending them to the server, and unpacking them.
Database navigation
A helpful but not essential feature is database navigation. With this feature, you can browse the database your application talks to, find out the table and field names, and runqueries. Some systems even automate writing some of the database access code for you.
Integrated Web browser
Some of the IDEs support an integrated Web browser that can navigate directly to the page you're editing with additional arguments you specify, the browser being hostedwithin the IDE or invoked externally. To be honest, I'm not a huge fan of the integrated browser because I don't mind switching between editing the code and viewing the resultin two separate applications. But I can see the attraction, and it's not required that youuse it.
Snippets
 
The last feature I found in all these IDEs was support for both canned and custom codesnippets.
Snippets
are little fragments of code that perform small tasks, such as runninga regular expression on some input, connecting to the database, and querying thedatabase.That sums up the core features you can expect from a purchased or open source IDE today.From here, we look at some popular IDEs. We'll show some pictures of what they look like; andexplain what they support, and how much they cost, if anything.
Eclipse
Two plug-ins support PHP in the Eclipse development platform. The first, PHP IDE Project, isan Eclipse Foundation project, which means it is released under the Eclipse license and isdeveloped using the Eclipse Foundation's tools and processes.The other is PHPEclipse and is developed independently. As with Eclipse, both run on the BigThree operating systems: Windows, Linux®, and Mac OS X. You can download just the plug-ins (if you already use Eclipse), or download a pre-fab version with everything you need.Both plug-ins support core IDE features you would expect to find. The code intelligence isrock-solid, pops up when you want it, and displays all the information you need for classes,methods, and arguments.Figure 1 shows PHPEclipse running on Mac OS X. On the left side is the project view with thefiles in the project. Below that is the class view, which shows any classes I've defined. In thecenter is my code. I can have multiple files open in multiple tabs simultaneously. On the rightside are panels for debugging and browsing. This is the stock PHPEclipse user interface.
Figure 1. PHPEclipse on OS X
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...