This article on advanced OOP for WordPress was originally published by Torque Magazine, and is reproduced here with permission. I’ve written a lot about object-oriented PHP and the WordPress REST API for Torque over the past few years….
Source: https://www.sitepoint.com/wordpress-advanced-oop-customizing-rest-api-endpoints/