|MySQL Conference and Expo April 14-17, 2008, Santa Clara, CA|
PHP with Apple's Developer Tools
The table below shows some of Project Builder's text navigation key bindings. These keys may not be listed under the Edit menu, but they are supported by Cocoa's
The editor has a number of other noteworthy features. When you are editing a file, you get many levels of undo and redo, using the command-z and command-shift-z key combinations; it is even possible to undo changes back to a point prior to the time a file was last saved. When you need to see two files at once, command-" (command-shift-quote) will split an editor window in two, and command-' (command-quote) will later collapse the two editors back into one. To search for a string in the current editor, you can obtain a standard search-and-replace dialog box using command-f. Much more powerful, however, is the Project-wide Batch Find feature, which is available by selecting the Find tab above the editor panel or with the key combination command-shift-F. In the batch find panel you can search the entire project or even a customized subset of files for a simple text string or a complex regular expression.
As previously mentioned, one of Project Builder's best features is its integration with CVS and FileMerge. To see an example of this, open one of the files in the PEAR project, make some changes, and save them to disk. Then pull down the CVS menu and select Compare/Merge with latest revision. Project Builder will initiate a
What's in a Project
At this point, it's helpful to understand what Project Builder does behind the scenes. Close the PEAR window, quit Project Builder, and look in the directory where you downloaded the PEAR files. Project Builder has created one folder, called
The TextEdit window shows the raw text of the project file (you could easily corrupt it, so be careful not to save any changes). The PropertyListEditor application allows you to navigate the tree structure of a property list or dump it into XML format. The contents of these files can be cryptic, but one thing is clear about them: the
Project Builder was built primarily for Cocoa developers but has many features that are useful for Web developers. Using it outside its intended realm like this, though, one tends to find small items of annoyance here and there. (Some of them might be called "bugs," but then for the developers to address them might also be deemed "feature creep.") For instance, many Web projects contain plain HTML files, but when Project Builder sees a file with an .html extension it sometimes attempts to render the HTML, as it does with its Release Notes file, rather than let you edit the HTML source. However, if you create the HTML file in Project Builder itself (using File -- > New File), it seems that Project Builder will consistently open it for editing rather than rendering.
Another glitch for PHP developers concerns syntax coloring. In PHP, a string that is delimited by single quotes can contain literal double quote characters. The following is a legal line of code:
The unmatched double quote at the end of the string confuses Project Builder's syntax colorizer. You can put the colorizer back on track using a second double quote in a shell-style comment, like this:
Mac OS X is my environment of choice for developing PHP and Perl applications, primarily because Project Builder does a better job than any editor I know at making it easy to navigate a large collection of files. It helps me grasp the interdependencies in a big collection of source files, and I can always find the code I'm looking for quickly and easily. When running Apache and PHP on my Mac OS X machine, debugging becomes very easy. And when I decide to work on code in Java or C, I get to keep working in the same environment and take advantage of even more of Project Builder's features.
The best source of information on Project Builder is its online help. Apple also provides a Web page at http://developer.apple.com/tools/projectbuilder/, and there is a projectbuilder-users discussion list at http://lists.apple.com/.
John David Duncan works as a MySQL database administrator and Unix sysadmin, and as a freelance Web developer building data-driven sites with Apache and PHP.
Return to the Web Development DevCenter.
Comments on this article
1 to 7 of 7
1 to 7 of 7