phppsr-4psr-1

Which version of PSR is valid?


Maybe I don't understand fully. I read that PSR is PHP Standard Recommendation, but there are several version of PSR, For Example autoloader use PSR-4 instead Basic Coding Standard use PSR-1

I have to follow a specific PSR version Or I have to merge the good parts of them ?

Symfony follows the standards defined in the PSR-0, PSR-1, PSR-2 and PSR-4 documents,Then each framework uses different PSR ?


Solution

  • You can see the PSRs as one huge coding standard. They depend on each other but every PSR stands alone for itself. PSR-2 describes Coding Style Guide while PSR-4 describes the standard for Autoloading.

    Here is a website about the PHP Standards Recommendations. You can find there a full list of all existing PSR.

    PSR means PHP Standard RECOMMENDATION - so it is only a recommendation on how to handle/format a specific part of a php-application. The index is just a ID to identify what the psr is good for. Do not understand it as a version-number. PSR-0 and PSR-4 both cover the handling of Autoloader.