Facebook introduces XHP

Facebook again pushes the boundaries of PHP by introducing yet another tool,  just one week after announcing HipHop. This time, they introduce a new way of writing php code- XHP, the one they used on the Facebook Lite front-end.

XHP does this by making PHP understand XML document fragments, similar to what E4X does for ECMAScript (JavaScript). While PHP is typically used to write front-end code, by itself it isn’t a very good language for generating HTML (as evidenced by the popularity of templating engines like Smarty). XHP is something between a programmatic UI library and a full templating system…

…One last feature of XHP, which has been invaluable to us at Facebook, is that you can define your own elements which can condense a complex component into a simple XHP tag. XHP has a rich collection of declarations which let you define new elements, configure their expected attributes, as well as describe their content model. These features turn XHP into a powerful templating engine which is capable of simplifying complicated pages into easy to read high-level markup, but it’s up to you to create your own elements from the primitives that XHP defines…

A thumbs up for Facebook, constraint really drives innovation.

You can read more about the official announcement here, the documentation. Also, here’s a quick link to their open source repos on GitHub

Update: Rasmus Lerdurf, the creator of PHP posted a quick note on using XHP.

Related posts:

  1. Facebook is into Hiphop, PHP just got pimped!

0 Responses to “Facebook introduces XHP”


Comments are currently closed.
blog comments powered by Disqus