Dave Hulbert's Today I Learned (TIL)


HTTP messaging PSR-7 update

date: 2015-02-04 08:14:07

This is a quick update to my original blog post criticizing mutability in PSR-7.

The original blog post got a fair few tweets and traction on Reddit. More importantly, Matthew Weier O'Phinney, the lead author of PSR-7, read it and took time to respond with valid feedback on mutability vs immutability.

Before I got the chance to respond to Matthew, he posted on the PHP-FIG mailing list mentioning that he'd tried implementing an immutable version of the PSR in phly/http and it worked really well!

Immutability is (almost) always the best way to design interfaces. I'm please I (and others like @everzet on Twitter) managed to nudge the PSR in that direction.

The current version of the draft PSR-7 spec is now immutable at it looks like the final version will be too.

Finally, huge thanks to Matthew for not only responding to my feedback but also giving immutability a shot and even defending it on the PHP-FIG mailing list!