Hacker News new | ask | show | jobs
Show HN: Content Negotiation in PHP – API Without API (Symfony, Laravel, Temma) (old.reddit.com)
3 points by amaury_bouchard 79 days ago
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.