Download the PHP package znojil/http without Composer
On this page you can find all versions of the php package znojil/http. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package http
Znojil HTTP
Lightweight, strict, and robust implementation of PSR-7, PSR-17, and PSR-18 standards.
This library provides a clean HTTP Client (wrapper around cURL) and a complete set of HTTP Message objects (Request, Response, Stream, URI, etc.) strictly following PHP standards. It is designed to be lightweight with zero unnecessary dependencies.
ðĶ Features
- PSR-7 Implementation (HTTP Message interfaces)
- PSR-17 Implementation (HTTP Factories)
- PSR-18 Implementation (HTTP Client)
- Zero dependencies (production)
- Strict types & PHPStan Level Max compatible
- Immutable objects design
ð Installation
Install via Composer:
ð Usage
1. Sending a Request (Client)
The Client automatically detects the provided ResponseFactory (PSR-17). If none is provided, it uses the internal implementation.
Client Configuration
The Client constructor accepts optional parameters for configuring base URI, default headers, and cURL options:
The client does not follow redirects by default (3xx responses are returned to the caller). Enable via
CURLOPT_FOLLOWLOCATION => truein constructor or per-request options.
RequestFactory Helper Methods
The RequestFactory provides convenient methods for common HTTP operations:
File Upload (Multipart)
For file uploads with additional form fields, use cURL's native CURLFile via CURLOPT_POSTFIELDS:
2. Handling Incoming Request (Server)
Ideal for API endpoints or webhook processing.
3. Using Factories (PSR-17)
You can use the factories to create any PSR-7 object manually.
â ïļ Error Handling
The library throws PSR-18 compliant exceptions:
ð License
This library is open-source software licensed under the MIT license.
All versions of http with dependencies
psr/http-client Version ^1.0
psr/http-message Version ^2.0
psr/http-factory Version ^1.1