Return to profile for Thorsten Frommen

REST in Pieces: Working with the WordPress REST API in an Object-oriented Fashion

40 minute intermediate seminar

Description/Proposal

Since both the infrastructure and the first set of endpoints of the WordPress REST API got merged into Core, it’s obvious for plugin and even theme authors to jump on the bandwagon. If you are interested in a sweeping statement about this, this one’s for you.

In the first part of this talk, Thorsten briefly looks back on the history of introducing a REST API to WordPress. He then comments on the current state of WordPress Core, and what we might expect in the (near) future.

The currently suggested way to develop using the WordPress REST API includes using a handful of functions and maybe writing up a custom class that extends a gigantic abstract controller class provided by WordPress Core. In essence, this results in procedural code, with the used functions not even being pure (as they are using global variables). That’s why the second part of this talk is about WP REST Starter, a Composer package for working with the WordPress REST API in an object-oriented fashion.

Using the interfaces and default implementations provided by WP REST Starter helps you write proper object-oriented code that is easier to understand, easier to extend, easier to test, and easier to maintain. Furthermore, in case the internals of the WordPress REST API will ever change, you can rely on WP REST Starter taking care of this, if possible. No need to adapt all your RESTful WordPress projects.