PSR — The PHP Standards Recommendations Guide

Let’s code better, together.

Alexandre Daubois
11 min readSep 9, 2021

Writing my Ultimate Guide to Symfony Components made me want to do more articles like it. Why not do the same thing for PSRs? You may not realize it, but you may be using a lot of tools following the guidelines of these.

But first, what is an PSR? PHP Standard Recommendations are texts describing a common way to solve a specific problem. This way, projects following these recommendations will have an excellent interoperability by following the same recommendations and contracts. See this as a base skeleton everybody can rely on, and implement it its own way.

These recommendations cover a wide range of topics, from log management to cache management, from coding style to HTTP clients.

PSRs have a similar life cycle to PHP RFCs for example: they are drafts subject to drastic changes and discussions by developers. Once an agreement is reached, they move to review status, where minor changes can be made. Finally, the PSR is either accepted or rejected. There are other statuses like abandoned, or deprecated, but you get the idea. Here, we will only talk about accepted PSR, and also a bit about deprecated ones so you know they exist.

No code on this guide, only vulgarization. Let’s get into it!

--

--

Alexandre Daubois
Alexandre Daubois

Written by Alexandre Daubois

Lead Developer at Wanadev // Open-source contributor

No responses yet