Sure, you have a great REST API. But now your API users have no idea what it is fully capable of. In fact, they are forced to search documentation to know what they can do next with the data you’ve provided in the responses. Ugh! Let’s talk about hypermedia, and what should be done in modern PHP REST APIs. We’ll investigate standards, and what is required to meet the Richardson Maturity Model. Plus, I’ll show tools to help you get there.
Your next REST API should be Expressive
When building PHP applications, you should use a framework to make the job faster and easier. No sense recreating the wheel. But, for a REST API, using a full stack framework is simply overkill and will ultimately slow down execution with unneeded includes. With Expressive, a super lightweight microframework, we can use only pull in the pieces we need to satisfy requests with middleware, and say goodbye to wasted space and time.
Adam Culp (@AdamCulp) is author of Geekyboy, Zend consultant at Rogue Wave Software, host of @Beachcasts and @RunGeekRadio, organizer of @SoFloPHP and @SunshinePHP, enjoys helping others write good code, implement standards, and refactor efficiently. He is a voting member of the PHP-Fig, and holds a seat on the Zend Certification Advisory Board. When he is not coding or contributing to various developer communities, he can be found hiking around the world, teaching judo, or long(ultra) distance running.