What does PSR mean?

9
Hello everyone, I recently found a term called PSR in the PHP area, but the topic was not very enlightening in defining the real meaning of the word PSR, I saw that it was related to the Object Oriented area, I did a google search and I did not find much, I think I researched the wrong terms.

But anyway, could anyone explain the meaning of the PSR and its real application?

    
asked by anonymous 12.09.2014 / 15:14

2 answers

16

PHP Standards Recommendation ) are project specifications proposed by PHP-FIG (PHP Framework Interop Group), a group composed of representatives of expressive projects in PHP.

These standards are intended to facilitate reuse of code among the various projects implementing a particular standard.

One example is PSR-3 , which suggests a specification for Application Logging Interface . Any project that supports PSR-3 can simply replace the logging module with a compatible one that also supports PSR-3 with no impact on the original design (we have the idea of interoperability between projects).

In addition to the standard Logs, there are PSRs for implementations of autoload (PSR-0 and PSR-4 ), suggestions for code styles such as key position, indentation ( Use tabs or spaces? ) ( PSR-1 and PSR-2 ).

There are also draft proposals for standardization of documentation docblock ( PSR-5 ) and an interface to HTTP requests ( PSR-7 )

More information read the FAQ and visit the repository in GitHub with the standards already accepted by the group.

It's important to remember that adopting these standards in your project is optional .

No one is required to implement "X" functionality in a certain way, however it is recommended to deploy from a standard already known and adopted by the community so as not to cause future headaches with your code.

    
12.09.2014 / 15:51
8

I found an answer:

The PHP Framework Interoperability Group is a group of members with voting power and representing PHP frameworks and non-voting members who can participate and who have defined three standards: PSR-0, PSR-1 and PSR -2.

The PSR-0 standard, dictated regarding autoloader. The PSR-1, from basic coding standards and PSR-2, goes further than the basic PSR-1 standardization.

How to access the PSR style guide

Via URL, via

PSR-0: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
PSR-1: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md
PST-2: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md

Via Git, I recommend

git clone git://github.com/php-fig/fig-standards.git
    
12.09.2014 / 15:44