PSR-18
PSR-18 is a PHP Standard Recommendation that defines a common interface for HTTP clients, allowing developers to send HTTP requests and receive responses in a standardized way. It provides a set of interfaces (e.g., ClientInterface, RequestInterface) that decouple application code from specific HTTP client implementations, promoting interoperability and testability. This standard is part of the PHP-FIG (Framework Interop Group) initiative to establish best practices across PHP projects.
Developers should learn and use PSR-18 when building PHP applications that need to make HTTP requests to external APIs or services, as it ensures compatibility with various HTTP client libraries (e.g., Guzzle, Symfony HTTP Client) without vendor lock-in. It is particularly useful in microservices architectures, API integrations, and testing scenarios where mocking HTTP clients is required, as it simplifies switching between implementations and improves code maintainability.