BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News WordPress.com Replaces PHP with JavaScript

WordPress.com Replaces PHP with JavaScript

Lire ce contenu en français

WordPress.com has replaced PHP with web technologies and a RESTful back-end API for the administration console.

Writing about why WordPress.com decided to move from PHP to JavaScript, Matt Mullenweg, Founder and CEO of Automattic Inc., the company behind wordpress.com, said that the foundations of the platform were not strong enough for what is to come, and some of WordPress’ strengths were also drawbacks. The main component affected by this overhaul is the administrative interface which saw a remake in version 3.8., but gave Mullenweg the conviction that an “incremental approach wouldn’t give us the improvements we needed.” He added that “backward compatibility and working without JavaScript “ were the main culprits in having the interface the way it should be.

Automattic decided back in 2014 to create a new admin interface called Calypso built using web technologies –JavaScript, HTML, CSS, Node.js, React, Flow, WebPack, Babel – and accessing the back-end through a RESTful API. Andy Peatling, Calypso Project Lead, has written on what it meant for a PHP/MySQL company to switch to JavaScript. They had a few advanced JavaScript developers who could contribute to the project, the others being “intimidated” by Calypso. They had also used Trac for project management and had done very little code review. Starting using GitHub and its pull request system followed by commit and code review helped them see “how much easier internal collaboration could be, and how to allow for much greater feedback on individual work being done.” Although initially intimidating, code review “greatly increased the quality of our codebase and helped everyone level up their JavaScript skills.” Over a period of 20 months they went from 7 contributors to 127 and over 26,000 commits. The team has also implemented continuous integration.

The new interface is a single page application with a responsive design adapting to screens of various sizes. According to this feature comparison table, Calypso is fast with near instant page loads, instant publishing, in-page previews for multiple targets, and changes are applied in real time without reloading.

One of the benefits of using a JavaScript responsive design is that creating desktop or mobile clients is much easier than before, as Peatling remarked:

By the middle of 2015 the Calypso codebase was in good enough shape to be used outside of the web browser. Since Calypso is entirely JavaScript, HTML, and CSS, it can run locally on a device with a lightweight node.js server setup. Using a technology called Electron, we built native desktop clients running the same code bundled inside the applications. We started work first on a native Mac desktop app, which is now available, and continued that work on soon-to-be-launched Windows and Linux apps. Seeing these apps come together and using them internally really started to justify all the hard work we’d spent building the Calypso codebase.

Automattic has open sourced Calypso, but they still have “a ton to figure out around plugins, extensibility, contributions, Windows and Linux releases, API speed, localization, and harmonizing the WordPress.com API and WP-API so it can work with core WordPress,” according to Mullenweg. Also, they leave it to the community to decide the inclusion of Calypso in the Core WordPress to replace or not the current admin interface.

WordPress is currently used by a quarter of world’s CMSes, according to W3Techs, up from 13% as it was in 2011.

Rate this Article

Adoption
Style

BT