PHP code example of mohamedmohamedhekal / integrator

1. Go to this page and download the library: Download mohamedmohamedhekal/integrator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mohamedmohamedhekal / integrator example snippets


use Hekal\Integrator\Facades\Integrator;

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

$data = $response->json();

'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,
        ],
    ],
],