The news is now old that investors will be given a chance to trade big piles of cash for a piece of the pile of code known as Facebook.com. Just a short time ago, few of us would have predicted that a pile of PHP would be worth billions of dollars, but clearly we underestimated the power of the platform.
To get a flavor for the latest in PHP programming, I spent some time unpacking the current set of development tools for PHP -- eight in all. I built some projects, modified some plug-ins for popular content management systems, and experimented with building another pile of PHP that will be worth many billions of dollars if I keep my fingers crossed.
There has been much progress over the years. In the past, I've generally relied upon emacs to create the code. When I needed to watch a variable, I would just print it into a Web page and trace the flow through there. That technique is generally adequate for basic debugging because the traditional job of PHP is to do a bit of basic data manipulation and get out of the way when the database shows up to do the real work.
That's changing. The integrated development environments are proliferating, and more development is moving into the cloud. The integrated tools manage the stacks of code, juggle deployments, catch debugging information, store the code in source repositories, and in some cases even automate deployment to the cloud.
But while the tools are more capable than ever, they often felt overly complex and sometimes even rough around the edges. Some of them seem to be bopping along in a state of neglect. Given the prevalence and maturity of PHP, I was surprised by some of the difficulties I ran into. The good news is, whether you lean toward a heavyweight tool packed with features or a lighter-weight tool that brings some polish, there is an option here for you.
Zend Studio Zend Studio is one of the two major commercial packages built around plug-ins for the Eclipse platform. In theory, you can get many of Zend Studio's features for free with the open source PHP Development Toolkit (PDT), Eclipse plug-ins that are built in part with help from Zend. But I had no success with them. My version of Eclipse (3.7) wouldn't install the current PDT plug-ins because of a long list of conflicts. These could probably be eliminated with some judicious pruning of the code -- something that open source makes possible -- but I lost patience.
Zend's website offers a long checklist of the differences between the PDT plug-ins and Zend Studio, but many of the differences have little to do with PHP development directly. For instance, Zend Studio offers GIT and SVN support, but PDT doesn't. However, anyone using Eclipse can install other plug-ins with these features that work with all languages.
Two of the main features you get for $299 are stability and testing. I had little luck getting the PDT plug-ins to work with my current version of Eclipse or even with a clean version of Eclipse I tried from scratch. Zend Studio, on the other hand, started right up. Zend integrates the plug-ins and removes the roadblocks before distributing everything as one big ball of code. You can use the various tools in Zend Studio separately as plug-ins, but installing the bundle made more sense. In theory, these plug-ins should play nicely together. In practice, it's easier to pay someone to make sure it's true.
Despite all of this, there were still moments when I struggled. While Zend Studio said it could detect the Zend Server, I had to fiddle with several buttons until the application would deploy. There are a number of features for controlling the deployment, and configuration is not as simple as a push of one button. Deployment options include using the local server, deploying to a distant version of Zend Server, or connecting to phpcloud.com, and this flexibility comes with a price.
PhpStorm PhpStorm is the product of a company that also makes Java IDEs, in this case JetBrains, which may be better known for the highly regarded IntelliJ. JetBrains' PHP tool, however, doesn't come integrated with its Java tool, unlike many of the other IDEs described here. I suppose there might be some developers who are creating hybrid PHP/Java applications and might be disappointed by this, but I don't think there will be many. It's still possible to run both IntelliJ and PhpStorm on the same machine.
PhpStorm exhibits much of the same attention to detail that made IntelliJ popular. I still find IDEs like Eclipse to be a bit arcane, with their complex trees that often hide important jobs in some deep corner of the hierarchy. The folks at JetBrains have done a better job of cleaning up the UI and putting the buttons in places that are simpler to find and understand. All of the coloring and completion are here, but in a simpler form. Not that PhpStorm is simplistic -- for instance, there are six different preintegrated source control options, more than you'll find in the other tools.
Configuration benefits from a number of wizards to assist you in getting everything connected. While the other IDEs offer some fields that either work or don't, PhpStorm takes things a bit further.
PhpED NuSphere's PhpED is one of the older IDEs around, but it's one of the few that's avoided going astray and diluting itself by supporting every possible language. It's a PHP tool, and this is obvious from the moment you install it.
The tool comes with a sophisticated wizard for checking installation to make sure the debugger and the internal server were correctly configured. I found the simple wizard a welcome break from spending time trying to get the other IDEs to work with the server software installed. It's still possible to use PhpED with a separate version of PHP, but it's not necessary.
Not everything was perfect. The tools generally worked, offering all of the more sophisticated code manipulation features like code folding. But I had some trouble getting the IDE to connect to either MySQL 5.1 or 5.5 because it said I was using an old version of the client software. The forum would let me search, but then it would accuse me of generating automated searches for some reason.
Despite these issues, I found PhpED to be one of the easier tools to use. The user interface was snappy, and the integrated server made it simpler to start projects. PhpED is one of the most pleasant tools in the game.
phpDesigner To the file system, a PHP project is just a bunch of text. To the programmer, it's a complex stack of abstractions and logistical constructions. While some IDEs treat the code like text files, phpDesigner takes the programmer's view. It offers an elaborate set of templates and editorial menus that help you work with the logistical structure.
This structure is used in a variety of ways. The code completion learns your libraries, the search tool highlights any word you select with a double click, and the code explorer displays your code in a big tree. Poking around your code this way is quite useful, especially if it's not code that you wrote. The logical structure is often a bit easier to understand than raw text. There are separate lists for the constants, functions, and variables. If you want to find one, you click on that tree and the declaration appears.
The IDE also offers a fairly large collection of templates that can be useful if you can't remember the exact way to construct some method or line. You hit the Class button and class appears in your code with the curly brackets. If you work the buttons correctly, you can write quite a bit of parsable code simply by clicking.
PhpDesigner is one of the few IDEs that carry its own version of PHP with it. If you create a PHP file, you can execute it and get the results in a number of different forms that range from the raw input to the display in your browser. I had mixed results with this feature. My version of Drupal, for instance, wouldn't execute correctly at first because the debugger wasn't connected properly.
NetBeans It's natural to assume that NetBeans is an IDE focused on Java since it was built by Sun. But the NetBeans creators are also distributing a version focused on PHP. It still has plenty of Java-centric tools -- including a profiler that wants to know whether I want to instrument the basic Java classes too -- but there are plenty of other features for the PHP developer, including the standard coloring and code completion.
PHP editing works right out of the box, but testing takes a bit of configuration. I was able to get the IDE working with the classic WAMP distribution only after several trips to the php.ini file. NetBeans includes several hints for editing php.ini that appear when the debugger fails to connect after a few seconds.
PHP debugging is fully integrated with the IDE. If you drag your mouse over a variable name, it will post a balloon with the type of the variable and the value in it if it's a short one like an integer. A right-click will take you to the definition of a function. If you're a developer looking for a full IDE, it's pretty much what you want to see.
Komodo IDE ActiveState's Komodo IDE is another editing powerhouse aimed at helping people build and debug not just PHP but Node.js, Python, Perl, TCL, and Ruby. The newest version, 7.0, adds more collaborative editing so that several people can work on the same document at the same time, presumably without doubling the number of bugs being created. There's also a mechanism that uses ActiveState's Stackato platform to deploy your code to the cloud or a local machine.
The editor offers many features for working with the marked-up files, including code highlighting, code suggestions, and code folding. The editors work with all of the HTML and CSS, helping build the final Web view. There's a visual editor that works well.
The debugger includes a number of options for doing more than just stopping. It can count how many times the breakpoints are hit and even execute a bit of code at the breakpoint. This may be the biggest help for tricky problems buried deep in the call stack.
The documentation talks about the "breadth" of the IDE, and PHP sometimes feels a bit lost in the shuffle. PHP seems to be just another language, while Python and Ruby seem to get more attention. There were several places where the documentation was out of sync with the machine, prompting me to scramble to the Web for answers. Komodo also wants to integrate with the local PHP server to handle debugging. I couldn't use just any local version of PHP that might be more helpful.
CodeLobster The PHP world is dominated by several major projects, and the folks who built CodeLobster know this. They created a collection of plug-ins that tune the IDE for work on leading platforms, including WordPress, Drupal, and Joomla. The plug-ins come with the professional version of the tool, which sells for $120.
The free version of the tool is a classic IDE with a file browsing panel, an editor, and a good debugging relationship with Apache and PHP. You create your project in the Web server's directory, then CodeLobster lets you edit and debug it. When you want to save your code, CodeLobster provides connections to the four major version control systems: SVN, Git, Mercurial, and Tortoise.
The most distinctive features of CodeLobster are the plug-ins that simplify working with the major PHP projects. The Drupal plug-in, for instance, bakes in knowledge of Drupal's code, so the IDE can complete method or variable names as you start typing them. The help section includes some basic documentation about Drupal's structure as well. There's also a wizard that will import Drupal and create new templates for modules.
CodeLobster does similar things for nine other leading projects. This is a smart focus because much of PHP coding is focused on extending these ecosystems through new plug-ins and modules. Many of the PHP coders aren't building their own projects from scratch, but creating something that will interact with the standard code base.
Aptana Studio Zend Studio is not the only example of a repackaged version of Eclipse. Aptana Studio is also a bundle of plug-ins designed to make it easier to get going and, perhaps, prompt you to adopt the tools of the parent company, Appcelerator. Appcelerator spent a bit more time on the cosmetics, and Aptana Studio starts with a trendy dark grey look.
There are some PHP features included in Aptana Studio, but they're fairly basic. There's some code assist and formatting features similar to PDT, but the built-in server doesn't handle PHP files. There's no connection for debugging PHP.
Aptana seems focused mainly on creating a tool for Python and Rails developers. The menus offer much more extensive options for people using those languages. The PHP options are more like a bit of frosting -- in case the Python or Rails folks need to edit a PHP file. There's a PyDev perspective now and plenty of other commands for other languages, but PHP seems to be receding.
Picking a PHP tool When I was working on this review, Stuart Herbert, a PHP developer, switched to Sublime Text, a more basic text editor, and wrote about the change, extolling the simplicity. In essence, he didn't need all of the extra features from an IDE. He was happier with a smart text editor than a full-fledged collection of tools under one roof.
I often felt the same way when struggling with these tools. While all of them are useful and worth the money to serious PHP developers, they're more than is needed for many basic PHP jobs. If you're writing a bit of glue logic between the database and a smart AJAX client, the extra features of an IDE aren't especially useful. You can often get by with just an editor and using print statements to debug variables.
Part of my problem was that I encountered a surprising amount of chaos. PHP is hardly new, yet I encountered a number of rough edges that really slowed down development. I often had to wade through several versions of the PHP server before I found one that would work with each tool. Only a few of the IDEs seemed to work out of the box. I began to wonder why the developers couldn't just compile PHP into the IDE itself, something they probably didn't want to do because they wanted to integrate with a running server. Many Java IDEs compile and start up servers all within the same process. I've had much better luck starting up Java and Python stacks than getting PHP off the ground.
These problems were all solvable, but I think you need to be working on a bigger PHP project before the overhead of an IDE becomes worth it. The ability to search through all of the files and deploy quickly are more useful when you have a lot of files associated with a complex application.
A couple of the IDEs -- Zend Studio and PhpStorm -- seemed to bear this weight better than the others. Zend Studio, from the creators of PHP, is best for developers already familiar with Eclipse. PhpStorm, a simpler option, is a clean and polished tool that focuses on PHP.
The growth in this area promises to be in cloud deployment systems. There's a big explosion of cloud hosting tools that marry smart servers with load balancers and better instrumentation. More often than not, they lock out the developer and require all new code to be pushed to the server via Git or perhaps Subversion. Some of the most prominent examples are PHP Fog, Cloud Control, Orchestra, and Microsoft's Azure, although the list is growing longer and longer.
It would not be much trouble to add a Web-based editor to these services, and I can see that coming down the road. eXo's Cloud IDE lets you edit PHP files, although you can't really run them easily. You need to push stuff in and out with Git. The service also includes some nice hardwiring to the platform-as-a-service centers such as Heroku, Cloudbees, Cloud Foundry, and OpenShift, though the links aren't as simple as they could be.
For now, the IDEs promise to offer sophisticated development options for people who are creating big stacks of code. When you need to search through multiple files and track sophisticated data structures, the step-by-step debugging provided by an IDE becomes worth the effort to set up and maintain. But as the tools become more tightly integrated with the clouds, I'm looking forward to lighter-weight ways of wrangling the code.
This article, "Review: 2 PHP tools rise above the rest," originally appeared at InfoWorld.com. Follow the latest news in programming and PHP at InfoWorld.com. For the latest business technology news, follow InfoWorld.com on Twitter.
Read more about application development in InfoWorld's Application Development Channel.