PHP code example of omnibus / bluedart

1. Go to this page and download the library: Download omnibus/bluedart 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/ */

    

omnibus / bluedart example snippets




mnibus\Bluedart\BluedartGatewayFactory;
use Omnibus\Testing\RecordedHttpClient;

// Blue Dart's answer, recorded: no account, and nothing leaves the process.
$http = new RecordedHttpClient([
    '/token/v1/login' => ['JWTToken' => 'jwt'],
    '/tracking/v1/shipment' => ['ShipmentData' => ['Shipment' => ['WaybillNo' => '79123456789', 'StatusType' => 'DL', 'Scans' => ['ScanDetail' => [
        ['Scan' => 'SHIPMENT DELIVERED', 'ScanCode' => '000', 'ScanDate' => '02-Oct-2026', 'ScanTime' => '11:30', 'ScanType' => 'DL', 'ScannedLocation' => 'Bengaluru'],
    ]]]]],
]);
$gateway = (new BluedartGatewayFactory($http))->create(['client_id' => 'id', 'client_secret' => 'secret', 'login_id' => 'BOM12345', 'licence_key' => 'lic', 'customer_code' => '123456', 'origin_area' => 'BOM', 'sandbox' => true]);

$tracking = $gateway->track('79123456789');
echo $tracking->status->value, ' - ', $tracking->latest()?->description, "\n";   // delivered - SHIPMENT DELIVERED

$gateway = (new BluedartGatewayFactory($http))->create($options);   // $http: the application's HTTP client - none given, the factory makes its own; the options below