PSRs
PSRs, or PHP Standard Recommendations, are a set of specifications for PHP development that aim to ensure interoperability and code quality. They are maintained by the PHP Framework Interoperability Group (PHP-FIG), a community-driven organization. The PSRs are not enforced by PHP itself but are widely adopted by the PHP community and supported by many frameworks and libraries.
The PSRs cover various aspects of PHP development, including coding standards, autoloading, HTTP message interfaces, and
PSR-1: Basic Coding Standard, which defines the basic coding standards for PHP code, including file structure,
PSR-2: Coding Style Guide, which extends PSR-1 and provides a more detailed coding style guide, including indentation,
PSR-4: Autoloading Standard, which specifies a convention for autoloading classes from file paths, making it easier
PSR-7: HTTP Message Interface, which defines interfaces for HTTP messages, including requests and responses, to promote
PSR-11: Container Interface, which specifies a common interface for dependency injection containers, allowing for more flexible
PSR-12: Extended Coding Style, which is an updated version of PSR-2, providing additional guidelines for modern
PSR-14: Event Dispatcher, which defines an interface for event dispatchers, allowing for more flexible and decoupled
PSR-15: HTTP Handlers, which specifies interfaces for HTTP request handlers, middleware, and response emitters, promoting interoperability
PSR-16: Simple Cache, which defines a common interface for caching, allowing for more flexible and interchangeable
PSR-17: HTTP Factories, which specifies interfaces for creating HTTP messages, promoting interoperability between HTTP clients and
PSR-18: HTTP Client, which defines a common interface for HTTP clients, allowing for more flexible and
The PSRs are designed to be flexible and extensible, allowing for community-driven improvements and updates. They