PHPStorm Blows in with a Whirlwind of Code Prowess

Behind every good developer is a set of good tools. Note the word “set” — no matter how hard you try, there is never going to be one tool that does everything you need and does it better than any of the alternatives. Think of a Swiss Army knife: sure, you get a nice little pair of scissors, a screwdriver, a serrated blade, a regular blade, tweezers, a bottle opener and more. But would you rather use the scissors on the Swiss Army knife instead of a real pair of titanium-coated shears? Or cut your porterhouse with its little serrated blade rather than a steak knife?

Yet we would be remiss to ignore the fact that the Swiss Army knife has benefits of its own. It’s only one device to maintain, one device to improve, and if you find yourself in a different environment, only one device to bring with you. In the software world, an Integrated Development Environment (“IDE“) is a programmer’s Swiss Army knife.  One application that brings together as much of the developer’s workflow as possible in one integrated environment (see where the name comes from?).

Like the Swiss Army knife, an IDE is usually full of tradeoffs. You’ll get FTP support to upload and download files from remote servers, SSH support to run commands on them, SVN/CVS/Git/Mercurial support for version control and a whole lot more. But mostly these are compromised versions.

You’ll often find yourself firing up your standalone FTP client for better syncing support or easier setup when you need to just pop in and make a quick change. You’ll run all of your Subversion commands directly from the shell because you don’t quite trust your IDE’s SVN support not to screw up the delicate balance of hidden files and folders that is the SVN metadata (messing that up always leads to a world of hurt). You’ll open up files in a simple text editor because often enough the app will bog down indexing files and lock up when you just want to open up a couple files and make some quick changes. At least, this is how it was when I’ve used IDEs like NetBeans or Zend Studio.

Enter PHPStorm

PHPStorm comes from JetBrains, maker of a number of related IDEs optimized for different coding platforms. PHPStorm, as you may have guessed, is their PHP-focused product, although it also supports a wide range of formats and languages that web developers deal with on a daily basis: XML, YAML, JavaScript, .htaccess, HTML, CSS, LESS and much more.

PHPStorm is not a free product — as in neither like information nor beer — which may make some open-source heads scoff. But there’s a reason that professional photo editors don’t use the GIMP, they use Photoshop. Why a lot of those same open-source heads use Mac OS X, not Ubuntu Linux. And why engineers use Microsoft Excel, not OpenOffice Calc (no, not because of some grand conspiracy). Professionals need professional products.  And for professional programmers, PHPStorm delivers in spades.

Advantages of PHPStorm

More than anything PHPStorm is fast. Currently, I’m often working with files off a Samba mount from a remote dev server. It’s an okay setup, but now and then performing all of the common, minor IDE I/O operations over a network can bring the app to a crawl. Not so with PHPStorm. From the moment you import a project to the day after day mode of working with it (whether you restart the IDE or leave it open), PHPStorm is fast. You never feel like you’re waiting for it to do its thing in the background.  Either you’re waiting on a time-intensive action that you explicitly initiated or you’re zipping around code without even pausing for breath.  That’s been my experience as a certified Magento developer while  spending most of my time working with a code base of more than 16,000 files.

The only exception is when creating a project hosted on a remote server.  Rather than downloading in the background and letting you work with what’s already come down the wire, PHPStorm blocks you  from touching any open projects while it downloads the entire site. (Good to know tip: spend the time to exclude folders you don’t need before clicking away at the shiny “Finish” button).

But what’s most impressive about PHPStorm’s speed is what it does in that short amount of time. PHPStorm’s ability to cross-reference and perform static analysis of code is unmatched by any other IDE or code editor I’ve tried. If you’ve declared a variable and haven’t used it, PHPStorm knows. If you’re using a variable that may not have been instantiated because it was declared in a conditional scope, PHPStorm knows. If you’re calling an undefined method on a class, PHPStorm knows. If you pass an incorrectly typed parameter, return before code is called, have incorrect PHPDocumentor tags, call deprecated methods, use PHP features from the wrong version, duplicate array keys, or have unresolved include statements, PHPStorm knows!

Sure, those are all things you can get from tools like PHP_CodeSniffer.  But to have them baked right into your IDE, to appear instantly the moment you type, is invaluable.  And PHPStorm supports PHP_CodeSniffer too. This type of analysis saves precious time by finding potential bugs in code before I even run it — even in code I wrote in other IDEs I had yet to debug!

Speaking of PHPDocumentor, PHPStorm makes the most out of your PHPDoc comments.  Taking them from somewhat of an annoyance to an essential tool. Nor does it hurt that PHPStorm will generate most of the doc for you. Anytime it can’t resolve an object type or a class method it’s obvious why and a quick application of documentation fixes it right up. During the time that I’ve been using PHPStorm I have  never felt like it dropped the ball on something it should have known.

With any multipurpose tool, the more functions it has and the better those tools are, the more useful it will be. PHPStorm’s version control support is so good that I use it exclusively over the command line — even in the perilous cross-platform Samba mount setup. PHPStorm manages SVN changelists effortlessly, something that I often find too cumbersome to deal with on the command line. It integrates with Atlassian JIRA with aplomb allowing me to track time on an issue, create a changelist for it, commit its related changes and resolve the issue all with one easy step. Deployment to remote servers over FTP or SSH happens automatically in the background when files are modified. Navigating to a file, class, or symbol is as easy as one keyboard shortcut followed by typing the first few characters of the item in question. I can control- (or command-) click around classes and methods until my head spins. PHPUnit testing is fully supported with a great interface that allows you to jump immediately to failing code and diff the expected and actual results. Debugging is all in-IDE via XDebug remote connections.

And there’s so, so much more. PHPStorm is such a rich application that even though I’ve gone much further with it than the entire feature set of NetBeans, I still feel like I’ve barely scratched the surface. Luckily, there are very useful tip-of-the-day helpers and command searches to help you uncover it all.

Disadvantages of PHPStorm

Of course nothing is perfect and I do have a few complaints. Some of the configuration dialogs are more enigmatic than they need to be. The way the IDE handles projects is strange; opening a second project requires opening a new “window” and the only way to manage projects is through the Open Recent menu. Deployment can sometimes be testy to set up.  And I’ve found a couple of edge cases that make the app choke (e.g., trying to diff a minified CSS file with tens of thousands of characters on one line, or dealing with large unit test responses over a few megabytes in size). But these are rare, relatively minor annoyances that don’t even come close to overshadowing the overwhelming positives of the rest of the experience.

All in all, PHPStorm has become an absolutely invaluable tool for my work. So much so that I’ve bought my own license for personal use. After using it for some time now, I can really understand JetBrains’ motto of “Develop with pleasure!” PHPStorm may not make me a better programmer (no software can do that), but it has without a doubt helped me write better code faster, all while having more fun doing it. If you are a PHP developer who cares at all about the quality of your code, you owe it to yourself to give PHPStorm a try. Before you know it, you’ll wonder how you ever wrote code without it.

Endertech is a Los Angeles software development company able to provide solutions for your PHP programming and other web development needs. Contact us for your free consultation. The author of this article was Endertech Project Manager Steve Rice with minor editing by Digital Media Coordinator Casey.

Top Photo Source: Ben Andreas Harding under license