InfoWorld review: Eight PHP power tools
Eclipse PDT, NetBeans, NuSphere PhpED, and Zend Studio lead a capable field of IDEs for Web developers
NetBeans IDE
NetBeans is a free, multilanguage IDE available from NetBeans.org. Though NetBeans began life as a Java IDE, versions exist for Python, Ruby, JavaScript, Groovy, C/C++, and PHP. The NetBeans download site offers language-specific bundles, as well as a 300MB-plus kitchen-sink version that installs everything that NetBeans has to offer.
The IDE is Java-based, and it will run on Windows, Mac OS X, Linux, and Solaris. We installed the 6.7.1 version on Windows. NetBeans downloads as a self-installing executable, and the PHP installation includes code editors for PHP, HTML, CSS, and JavaScript. NetBeans PHP is also equipped with explorers for databases and Web services, as well as interfaces into a Hudson continuous integration server and the Bugzilla and JIRA issue trackers.
[ Nine Rails IDEs are leaving the station. Which one should you ride? See "Lab test: Climb aboard Ruby on Rails." ]
The NetBeans IDE interface is a collection of dockable windows, arranged in the familiar "explorers on the left, editors to the right" format. The explorers include a typical project navigator, a file system navigator, and a database explorer. To this trio, NetBeans adds a Web services explorer.
The Web services explorer is prepopulated with nodes corresponding to services from Amazon, Facebook, Google, and other popular sites. You can drill down into a particular service to examine its offered functions and their arguments. Even better: Drag a function from the Web service explorer onto a PHP file in the source editor window, and NetBeans will write the code necessary to call that Web service function.
NetBeans source editing has all the code completion fundamentals. It will close brackets and parentheses, and it provides context-sensitive proposals for PHP language elements: Type in an object and a pop-up appears, listing known instance variables and functions. If you've provided PHPDoc-formatted documentation for the class, that information will be displayed as well.
Because NetBeans PHP includes JavaScript editing capabilities, it will recognize when you have entered embedded JavaScript in the HTML portion of a PHP source file (via the "<script... >" tag) and provide context-aware code completion of JavaScript elements.
NetBeans supports debugging on both local and remote servers. To debug on a remote system, you must first establish FTP (or SFTP) settings for the project so that source files can be transferred to the debug target. NetBeans lets you configure your projects so that files are transferred when they are saved or when the source application is executed. Remote debugging also requires you to set up path mapping so that the debugger knows which local source file corresponds to a given URL on the remote system.
For PHP debugging, NetBeans uses Xdebug. The IDE can also debug client-side JavaScript using a NetBeans-supplied JavaScript debugger. (The NetBeans JavaScript debugger is based on Firebug, an add-on to the Firefox browser.) To debug JavaScript in a PHP file, simply start a debug session, select to debug PHP and JavaScript in the ensuing window, and a Firefox window is launched with the NetBeans JavaScript debugger installed and activated.
NeBeans' database explorer can access any JDBC-accessible database. NetBeans will automatically detect a running MySQL server at the standard port and create a MySQL server node on the database explorer tree. Right-click the node, and a pop-up opens with commands for starting or stopping the server, opening or closing a connection, running the MySQL administration tool, and so on.
Once you've opened a connection to a database, you can expand the explorer to examine views, stored procedures, and tables. Right-click on a table icon, choose View Data, and an SQL command window opens (pre-populated with a "Select *..." command that executes), displaying the data in tabular form in a separate results window. The results window also provides interactive access to database rows; you can add, delete, or modify rows without having to specify SQL commands.
All in all, NetBeans has one of the briefest startup times of any of the IDEs. Configuration is minimal; we were up and running in a remarkably short time. And debugging in NetBeans was as easy as it gets. In short, NetBeans PHP just worked -- which is just what you want.