Original author(s) Development status Active | Developer(s) Facebook | |
Initial release February 2010 (2010-02) Stable release 2.2.2 / July 14, 2015; 20 months ago (2015-07-14) |
XHP is an augmentation of PHP and Hack developed at Facebook to allow XML syntax for the purpose of creating custom and reusable HTML elements. It is available as an open-source software GitHub project and as a Homebrew module for PHP 5.3, 5.4, and 5.5. Facebook have also developed a similar augmentation for JavaScript, namely JSX.
Contents
Origins
XHP was loosely inspired by ECMAScript for XML and created by Marcel Laverdet. It was first developed for Facebook Lite as a new UI rendering layer but was later ported over to Facebook's www and mobile web stack as well as incorporated into HipHop for PHP. It was made available to the public in February 2010 and now accounts for nearly all of Facebook's server-side generated HTML over all of its properties.
Benefits
XHP offers a much cleaner interface to UI programming when outputting HTML in PHP, but has some engineering advantages as well.
setAttribute()
, getAttribute()
, appendChild()
, and several others prior to or during render.