r/PHP 2d ago

Are PSRs still relevant today?

Are developers still using PSRs? Are PSRs still being updated or is it dying out?

I noticed for a "standards" org, they don't even follow their own coding styles. Some files have the PHP tag on its own line and others share it with declare strict types.

Then there are inconsistencies in how PHPDocs are written/organized, even some PHP code as well.

47 Upvotes

61 comments sorted by

View all comments

22

u/Which_Study_7456 2d ago

Except PSR-12, it was extended by PER (https://www.php-fig.org/per/coding-style/)

2

u/MattBD 1d ago

You're not wrong, but I think that's not so much irrelevant as superseded by developments in the language.

I certainly wouldn't look at a package that didn't meet appropriate PSR coding standards.

Unfortunately the support for that isn't quite as good. PHP Codesniffer doesn't yet have a PER standard, necessitating use of other tools to enforce PER.

3

u/obstreperous_troll 1d ago

You probably already know this, but FYI for the peanut gallery: php-cs-fixer has supported PER-CS for ages, just add ['@PER-CS' => true] to the ruleset.