Show HN: Content Negotiation in PHP – API Without API (Symfony, Laravel, Temma)(old.reddit.com)
old.reddit.com
Show HN: Content Negotiation in PHP – API Without API (Symfony, Laravel, Temma)
https://old.reddit.com/r/PHP/comments/1sc8ste/content_negotiation_in_php_your_website_is/
I'm preparing a talk on APIs for AFUP Day, the French PHP conference. One of the topics I'll cover is content negotiation: making your website serve both HTML and JSON from the same endpoints, depending on what the client requests via the Accept header. This avoids building and maintaining a separate API alongside your website. The post shows the same example implemented in Symfony, Laravel and Temma, from explicit conditional code to a fully declarative approach.
0 comments
—