We use cookies to provide you with a better experience. If you continue to use this site, we'll assume you're happy with this. Alternatively, click here to find out how to manage these cookies

hide cookie message
80,258 News Articles

Facebook launches simplified API for developers

PHPEmbed library online now

Facebook has made it easier for developers to embed PHP by developing a simplified API and then releasing its PHPEmbed library.

"The library is just a more accessible and simplified application programming interface (API) built on top of the PHP Server API (SAPI). The library is so useful, we decided to share it with the world," writes Facebook Engineer Andrew 'Boz' Bosworth.

Bosworth said that the PHP programming language has solidified itself as the language of choice for many top Internet properties, including Facebook, as it is easy to use and integrates well with Apache, Memcache, and MySQL.

"Despite its suitability for web development and scripting, PHP is generally not the best choice for stand-alone software or servers. C++, on the other hand, is well suited for building both online and offline services," he writes.

"Unfortunately, if the new services operate with data managed by the existing PHP code base it can be dangerous to use a separate data access pattern. If the cache keys or database schema were to change in the PHP code base then the service would be broken (and potentially corrupting data for the PHP code base) until the code was updated and the program recompiled and restarted."

It was in response to this problem that Bosworth and his colleagues decided to embed the PHP Interpreter into C++ binaries.

"This isn't a novel endeavor by any means; Apache uses the PHP Server API (SAPI) to accomplish exactly that. However, when we began attempting integration of our own we found that the SAPI required quite a bit of expertise to manipulate effectively," Bosworth says.


IDG UK Sites

Best Black Friday 2014 tech deals: Get bargains on smartphones, tablets, laptops and more

IDG UK Sites

What the Internet of Things will look like in 2015: homes will get smarter, people might get fitter

IDG UK Sites

See how Trunk's animated ad helped Ade Edmondson plug The Car Buying Service

IDG UK Sites

Yosemite tips: Complete Guide to OS X Yosemite