read

I haven’t really posted about PSR-4 here other than as a footnote in this old article, but if you follow me on Twitter or hang out on Reddit you’ve probably seen some news about it.

PSR-4 was voted in as an “accepted” PSR by the FIG in December. It took a little while to get done and went through a series of painful rewrites but when we have in the end is a document that reflects what this truly is: an improvement on PSR-0.

Today Jordi Boggiano merged a pull request by Andreas Hennings into master branch of Composer that contained support for PSR-4. Andreas was a massive help to the FIG while we were trying to shake the issues out of PSR-4 during Draft and Review stages, so he really outdone himself by providing the code too.

Jordi wrote a blog about why you don’t want to switch all of your packages immediately to PSR-4 as many users won’t be reminded to update for another 30 days, so for now I am suggesting people create a feature branch called “feature/psr4” for those who want to try it out, to get their packages and unit-tests ready for February 4th 2014 - when it will be “PSR-4 Upgrade Day”.

Converting is easy as hell. Take a look at Fractal feature/psr4 to see how to do it yourself.

The Composer Autoload documentation is already updated for PSR-4 too.

Please post up here in the comments or on Twitter if you upgrade your package(s) to PSR-4. I’d love to make a list of early adopters on here, and maybe make it into another article in a few weeks.

Blog Logo

Phil Sturgeon

Phil has contributed to CodeIgniter, FuelPHP, Laravel and handfuls of other projects, to try and make the PHP community a better place.


Published

Build APIs You Won't Hate

Everyone and their dog wants an API, so you should probably learn how to build them.

Buy it from LeanPub for $26.99


Published 01 Feb 2014

Image

Phil Sturgeon

Founder of PyroCMS, Senior Developer at Ride, Programming Polyglot, PHP-FIG member, and occasionally gets chased by bears

Back to Overview