avris/http
Lightweight HTTP client for PHP/Laravel with a clean, fluent API for making requests and working with responses. Designed for simple integrations, sane defaults, and easy customization of headers, query params, timeouts, and body formats.
App\Http\Kernel for request/response modifications.bind(Client::class)).Validator for request payloads.avris/http is straightforward, as the package provides a drop-in replacement for HTTP transport logic.Illuminate\Http\Request may require careful refactoring (e.g., middleware compatibility, route model binding).Request/Response, leading to conflicts if both are loaded.| Risk Area | Mitigation Strategy |
|---|---|
| Middleware Conflicts | Test with Laravel’s App\Http\Kernel to ensure Avris\Http\Request integrates seamlessly. |
| Performance Overhead | Benchmark against Guzzle/Symfony HTTP Client for critical paths (e.g., high-throughput APIs). |
| Laravel Version Lock | Pin Laravel/Symfony dependencies to avoid compatibility issues. |
| Limited Adoption | Mitigate by treating it as an internal abstraction (not a public API). |
| Type Safety | Ensure PHP 8+ type hints align with Laravel’s expectations (e.g., RequestInterface). |
handle() method compatibility)?Illuminate\Http\Request in controllers?Illuminate\Http\Request unless the package offers full compatibility.reactphp or symfony/amphp).Phase 1: Outbound HTTP Clients
avris/http.// Before
$client = new \GuzzleHttp\Client();
$response = $client->get('https://api.example.com/data');
// After
$client = new \Avris\Http\Client();
$response = $client->get('https://api.example.com/data');
Phase 2: Middleware Integration
avris/http for request/response transformations in middleware.$client->addMiddleware(function ($request) {
$request->headers->set('X-API-Key', config('services.api.key'));
});
Phase 3: Inbound Requests (Optional)
Illuminate\Http\Request with Avris\Http\Request in controllers/middleware.Phase 4: Deprecation
| Component | Compatibility Check |
|---|---|
| Laravel Middleware | Verify Avris\Http\Request supports Laravel’s middleware pipeline (handle() method). |
| Validation | Test integration with Laravel’s Validator (e.g., request()->validate()). |
| Routing | Ensure Avris\Http\Request works with Laravel’s route model binding. |
| Exceptions | Check if HTTP exceptions align with Laravel’s error handling (e.g., HttpResponseException). |
| Service Container | Confirm the package can be bound in Laravel’s container (e.g., bind(Client::class)). |
| CSRF/Sessions | Test if the package handles Laravel’s built-in security features. |
Avris\Http\Request).Avris\Http\Request vs. Illuminate\Http\Request).AB or Laravel’s built-in HTTP tools for critical paths.| Scenario | Impact | Mitigation |
|---|---|---|
| Package Bug | Broken HTTP requests/responses crash features. | Rollback to Guzzle/Laravel native classes. |
| Laravel Version Conflict | Package incompatible with Laravel 10.x. | Pin versions or fork the package. |
| Middleware Collisions | Avris\Http\Request breaks Laravel’s middleware. |
Isolate usage to non-critical paths. |
| Deprecation | Package abandoned; no updates. | Maintain a fork or migrate to Symfony. |
| Performance Regression | Abstraction adds latency to critical APIs. | Benchmark and optimize or revert. |
Avris\Http for all API clients").How can I help you explore Laravel packages today?