This is the first in a 3-part series.
Anyone new to PHP development with FileMaker will need a text editor application to write the PHP, HTML, CSS, and other code outside FileMaker. In this series of three posts, I’ll review some of the better-known text editors for the Mac OS. I researched this information to prepare for my PreCon session at FileMaker DevCon, Core Elements of PHP for FileMaker, Tuesday, August 2nd at 1:30pm.
I’m not necessarily talking about “best practices”. For full-time PHP development, you would typically use an integrated development environment (IDE) with revision control and project management for local and remote files. However, an IDE is a major investment in learning (and in some instances money), and the leap to a fully-fledged IDE rarely happens all at once.
Most users start off with an advanced text editor that still has rich features to help with development. I’m not going to cover all available applications, only ones which I have used over the years. The six apps that I will review are sufficiently different, and users will develop their own preferences; in some cases it may be useful to have more than one available. As I do most of my development in the Mac OS, all the tools I mention are Mac-oriented, though two of them are cross-platform.
Although every Mac comes with TextEdit, it is far from ideal for reasons because it lacks “code awareness.” For example, it does not have color-coding, so you can see the code on the screen at a glance (PHP vs. HTML), or element recognition, the type of elements in each language (function vs. string). Also, TextEdit tends to save documents in Rich Text Format (RTF).
Still, free is good, and two of the six apps I cover are free. These free apps have virtually all the features that you need, and one in particular is worth as much as some of the paid apps.
One of the first things I do when setting up a Mac web server is to install TextWrangler. Made by Bare Bones Software, who also make BBEdit, this application is perfect for development at zero cost. It comes with many of the features as its big brother, such as multi-file search, document comparison, color coding, and a vast array of keyboard shortcuts. There is no code complete or clippings (although you can store documents in a Text Factory folder). I would hesitate to use TextWrangler for large projects, but it’s perfect for quick work.
A quantum leap from TextWrangler is the cross-platform app KomodoEdit. I first heard about it from MightyData’s own Visionary of Value, Kirk Bowman, while reading through the DevCon materials from his session on PHP and FileMaker in 2009. Free and cross-platform? What’s not to like? I’ve promoted this app in my own classes on PHP and FileMaker because of the instant value.
Clearly, the people who developed this software see it as a gateway to their full-fledged IDE, and they advertise this option in the Start Page when you launch the app. The default extension is a text file, but a simple change in the preferences and your new documents are created with .php extension instead.
KomodoEdit is like a mini-IDE, handles project management quite nicely, and even debugs code within the document (to some degree). If you make a common beginner mistake such as leaving off a semi-colon, the area around this gets a red underline to alert you that something is wrong. You can split the text window (like Excel), code folding is intuitive and visual, and the preferences allow a great deal of fine-tuning.
KomodoEdit is hands down the best free text editor for the Mac, and even better than several paid apps. I have on occasion run into strange issues with inconsistent color-coding. Also the soft-wrap option adds a distracting character on the right side of the screen when text wraps. But these are minor issues. And did I mention that it’s free?