News for hackers. Stuff that matters.
Re:Macaw - A Simple PHP Router by krapp on Saturday December 28, 2013 @11:22PM (#6978356)
really nice.

if I had any suggestions at all though it would be to have the 404 route actually return the 404 header (or have a way to specify headers with routes), and also have it handle https.

Re:Macaw - A Simple PHP Router by NoahBuscher on Sunday December 29, 2013 @12:34AM (#6978548)
Great! I'll get to work on these. :D
Re:Macaw - A Simple PHP Router by X4 on Sunday December 29, 2013 @03:24AM (#6978884)
how about caching as a separate composer requirement, or do you think caching should be in a higher level in the stack?
Re:Macaw - A Simple PHP Router by krapp on Sunday December 29, 2013 @09:34AM (#6979616)
If you can send headers with routes then I suppose you could cache with them as well. Although that could also get a bit tricky if you didn't want the routes to enclose an entire document. The typical use cases i'm thinking of would be a json route and an image route.

Probably, all a bare minimum viable url router should do is display some content based on a url or fail to an error code. I would post my own experiments with building a url router that deals with everything (because I tried it) but the end results were objectively worse than what's already been posted here... i've found that it helps to have the router, and whatever process handles rendering the document as a whole (including headers and caching) be completely separate.