pdeans/http
Lightweight PSR-7 cURL HTTP client with PSR-17 factory support, built on Laminas Diactoros. Configure via curl options and use helper methods for GET/POST/PUT/PATCH/DELETE/HEAD/TRACE with headers and optional body streams/resources.
curl_exec() calls in legacy PHP/Laravel applications with a maintainable, standards-aligned client.RequestInterface, ResponseInterface) without coupling to cURL.Adopt if:
HttpClient facade) and prefers standards-based solutions.Look elsewhere if:
HttpClient facade or Eloquent/Queue integrations (this package lacks those)."This package provides a lean, standards-based HTTP client that replaces fragmented cURL code with a maintainable, scalable layer—reducing API integration risks and developer onboarding time. By adhering to PSR-7/PSR-17, we ensure compatibility with Laravel’s ecosystem while keeping the solution lightweight and future-proof. It’s ideal for API-heavy applications where simplicity and compliance matter more than advanced features like retries or async support. Adopting this client will reduce technical debt from ad-hoc HTTP implementations and align with modern PHP standards."
Pros:
StreamFactory, UriFactory).Cons:
HttpClient facade, Eloquent, or Queue (use Laravel’s built-in client if those are critical).Recommendation:
curl_exec() with a type-safe, PSR-compliant client in 10 minutes.get(), post(), etc.) for common HTTP verbs with minimal boilerplate.Psr\Http\Message\RequestInterface).// Before (Legacy)
$ch = curl_init('https://api.example.com/data');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
// After (pdeans/http)
$client = new \pdeans\Http\Client();
$response = $client->get('https://api.example.com/data', [
'Authorization' => 'Bearer token123',
'Accept' => 'application/json'
]);
$data = json_decode((string) $response->getBody(), true);
How can I help you explore Laravel packages today?