4 ways PHP coding is getting less painful

Users kick up performance, package management, and community relations for the popular yet widely reviled language

It's easy to hate PHP despite the culture of software built on top of it. InfoWorld even compiled its own list of 12 things about the language that drive developers crazy.

But over the past few years, PHP has accrued changes -- to the language itself, to the ecosystem around it, and to the supporting developer community -- that are worth noting. Though users who've ditched PHP for Python or Ruby won't likely be brought back anytime soon, they're signs that some folks are committed to making the most of PHP. Here are the four biggest improvements.

1. Package and dependency management

Until recently, the only practical way to do package management for PHP was to use PEAR (PHP Extension and Application Repository). But PEAR's long been regarded as difficult to work with and it's crowded with outdated and unmaintained software. Many of the more popular PHP frameworks had their own private package-management systems -- CakePHP's Bakery, CodeIgniter's Sparks -- but little or nothing for PHP as a whole.

The biggest change to come along in this space is Composer, which takes notes from Node.js's NPM system and Ruby's Bundler. Packages are tracked on a project-by-project basis so that it's easy to determine which packages are needed for a given project and can be installed automatically. It works with a repository named Packagist, which already includes many common PHP apps, frameworks, and components.

2. Hack/HHVM

Two of the most significant changes to PHP have come from outside PHP itself, courtesy of Facebook: the Hack language and the HHVM (HipHop Virtual Machine). The former takes PHP and adds features not present in PHP by default, such as static object typing. The latter compiles PHP code to C++ code for fast execution, yielding a near-tenfold increase in performance. Both are still relatively new innovations, so their long-term impact on PHP has yet to be felt. But they show at least one major Web player takes PHP seriously enough to keep it alive as its platform of choice.


No, that's not a new Nabisco snack. It's the PHP Framework Interop Group, a collection of PHP developers representing major projects who've organized to develop standards for how to develop their projects in a consistent manner. Folks from CakePHP, Drupal, Joomla, and SugarCRM, among others, are already part of the team, and the group has drafted several standards that cover things like coding style guides, interfaces for logging libraries, and how to handle the automatic loading of classes.

By its own admission, the group is entirely voluntary and unofficial, but it hopes that "over time that cross-section will represent a wider selection of projects."

4. The Phpng project

The next version of the language itself is also a hotbed of ideas for how PHP can be improved. The development branch of PHP, dubbed Phpng, includes improvements to how much memory is needed for certain operations and the number of machine instructions needed to complete a given action. Much of this work has been sponsored by PHP vendor Zend Technologies, whose PHP engine is found in many commercial installations for the language.

Granted, most of those improvements involve goosing performance rather than changing the much-derided syntactical idiosyncrasies of the language, which unfortunately seem here to stay. Maybe the next big revolution in PHP won't be a full-blown fork along the lines of Hack, but a transpiled language similar to those that extend JavaScript while at the same time compiling natively.

This story, "4 ways PHP coding is getting less painful," was originally published at InfoWorld.com. Get the first word on what the important tech news really means with the InfoWorld Tech Watch blog. For the latest developments in business technology news, follow InfoWorld.com on Twitter.

From CIO: 8 Free Online Courses to Grow Your Tech Skills