Source Maven

Code Partition for Beau Simensen

PSR-7 and the future of PHP

At long last PSR-7 HTTP Message Interface (meta) is finally up for review! I've been tracking this since Benjamin Eberlei sent his first pull request for what he considered at the time a proposal for a HTTP client close to three years ago. This one has been a long time coming!

I had a chance to talk about it on PHP Town Hall with Michael Dowling just over a year ago. It was the first time I talked openly about wanting to see the current proposal eventually become something that could be the basis for a common HTTP layer that could be used on the server side as well.

Since then, Michael stepped down from working on PSR-7 but it was later picked up by Matthew Weier O'Phinney. We had a chance to talk in person about it at Madison PHP 2014 just before he officially took on the role of editor. I could tell that Matthew was super excited about it and was very much inline with my visions for the future as well.

In a nutshell: what I dream of for PHP is that we stop thinking of ourselves as Zend Framework, or Symfony, or Laravel, or Aura, or FrameworkFlavorOfTheDay developers, but instead think of ourselves as PHP, HTTP, or Web developers.

— Matthew Weier O'Phinney, September 2014

The work I've done on Stack was meant to be a reference for what working at the HTTP layer in PHP could look like. While it would have been great for Stack to truly be framework agnostic, tying Stack to HTTP Kernel Interface meant that this was always going to be an uphill battle. Still, Stack was able to show what it would look like at a smaller scale by allowing people to write code that could be shared between projects/frameworks within the Symfony ecosystem.

I'd love for people to start writing code for PHP rather than code for Symfony, Zend Framework, Laravel, CodeIgniter, WordPress, and so on. PHP has already started to move away from silos because Composer makes it so much easier to write and share packages. Still, far too many packages are written in the glue language of their favorite framework. If enough projects adopt PSR-7 I expect that we will see even more sharing of code in the PHP community than we are already seeing.