What is PSR in PHP?
Why Interviewers Ask This
Interviewers use this question to quickly assess whether a candidate has the foundational knowledge required for PHP development. It reveals whether you understand the building blocks that more complex concepts rely on.
Answer
PSR (PHP Standards Recommendation) is a series of interoperability standards published by the PHP-FIG (Framework Interop Group) to help framework and library authors write compatible code. Key PSRs: PSR-1 (Basic Coding Standard — file encoding, class/method naming), PSR-2 / PSR-12 (Extended Coding Style — indentation, braces, spacing), PSR-4 (Autoloading Standard — namespace to directory mapping, used by Composer), PSR-3 (Logger Interface — defines the LoggerInterface), PSR-7 (HTTP Message Interface — request/response objects), and PSR-11 (Container Interface — dependency injection containers). Following PSR standards ensures your code integrates smoothly with modern PHP tools and frameworks.
Pro Tip
Back up your answer with a specific project or situation. Saying 'In my last PHP project, I used this when...' immediately makes your answer more credible and memorable.