mohamedhekal/integrator

Resilient Laravel HTTP client toolkit: retries, rate limits, circuit breakers, and auth strategies

Maintainers

Package info

github.com/mohamedhekal/integrator

pkg:composer/mohamedhekal/integrator

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-07-16 14:23 UTC

This package is auto-updated.

Last update: 2026-07-16 14:35:19 UTC


README

CI License: MIT PHP Laravel

Search terms: laravel, http, api, retry, circuit-breaker, rate-limit, integrations, php, laravel-package, http-client, backoff, third-party-api.

Resilient Laravel HTTP client toolkit for third-party APIs: retries with backoff, Retry-After handling, circuit breakers, and auth strategies.

Problem

Every vendor integration reinvents retries, rate-limit waits, and failure isolation—usually inconsistently and without tests.

Installation

composer require mohamedhekal/integrator
php artisan vendor:publish --tag=integrator-config

Quick start

use Hekal\Integrator\Facades\Integrator;

$response = Integrator::client('demo')->post('/v1/shipments', [
    'reference' => 'ORD-1',
]);

$data = $response->json();

Configure named integrations in config/integrator.php:

'integrations' => [
    'shipping' => [
        'base_url' => env('SHIPPING_API_URL'),
        'auth' => [
            'type' => 'api_key',
            'api_key' => env('SHIPPING_API_KEY'),
            'api_key_header' => 'X-API-Key',
        ],
        'retry' => [
            'enabled' => true,
            'max_attempts' => 3,
            'base_delay_ms' => 200,
            'retry_on' => [429, 500, 502, 503, 504],
        ],
        'circuit_breaker' => [
            'enabled' => true,
            'failure_threshold' => 5,
            'recovery_seconds' => 60,
        ],
    ],
],

Features (v0.1)

  • Named clients via Integrator::client()
  • Auth: none, bearer, basic, api_key
  • Exponential backoff + optional jitter
  • Honor Retry-After on 429 (capped)
  • Cache-backed circuit breaker (closed / open / half-open)
  • IntegrationException with status/body/error code
  • Optional request logging

Testing

composer install
composer test

Architecture

See docs/architecture.md.

License

MIT