Requests for PHP is an HTTP client library that simplifies sending and receiving HTTP requests in PHP applications.
PHP's built-in HTTP tools are cumbersome and unreliable. The cURL extension has an unintuitive API, and sockets require developers to manually parse HTTP responses. Requests solves this by providing a clean, human-friendly interface inspired by the Python Requests library. It abstracts away the complexity of cURL and fsockopen, automatically selecting whichever is available on the system, and handles common tasks like authentication, SSL verification, decompression, and timeouts transparently. Developers can send HEAD, GET, POST, PUT, DELETE, and PATCH requests using simple arrays for headers, form data, and parameters, then access responses in the same straightforward manner.
Requests suits any PHP project that needs to interact with external HTTP APIs or services. It requires only PHP 5.6.20 or later and has no external dependencies, making it lightweight and easy to integrate. The library can be installed via Composer or manually from source. The README notes that while PSR-7 and PSR-18 standards were created after Requests, the library does not natively implement them, though a separate community package provides PSR-18 compatibility if needed.
The project maintains comprehensive PHPDoc documentation across its entire codebase and strives for complete test coverage with an extensive test suite. Contributions are actively welcomed through established guidelines.