PHP theorytheory 0/50 · 0%
Fundamentals · medium

37. PSR Standards & Autoloading

Interoperability conventions.

PHP-FIG's PHP Standard Recommendations (PSRs) define shared conventions so libraries interoperate: PSR-1/PSR-12 cover coding style, PSR-4 covers autoloading, PSR-3 defines a logger interface, and PSR-7 defines HTTP message interfaces. Following these lets frameworks and packages from different vendors work together seamlessly.

Composer's composer.json "autoload" section maps a PSR-4 namespace prefix to a source directory, e.g. mapping "App\\" to "src/".

Check your understanding

  1. 1. Which PSR defines the standard autoloading convention?

  2. 2. Which PSR defines a common logger interface?