PHP code example of mohamedhekal / shipbridge-smsa

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

    

mohamedhekal / shipbridge-smsa example snippets


use Hekal\ShipBridge\Facades\ShipBridge;
use Hekal\ShipBridge\DTOs\Address;
use Hekal\ShipBridge\DTOs\CreateShipmentRequest;
use Hekal\ShipBridge\DTOs\Parcel;

$shipment = ShipBridge::driver('smsa')->createShipment(new CreateShipmentRequest(
    origin: new Address('المستودع', 'شارع الملك', 'Riyadh', 'SA', phone: '0110000000'),
    destination: new Address('العميل', 'طريق فهد', 'Jeddah', 'SA', phone: '0555555555'),
    parcels: [new Parcel(weightKg: 2.0, description: 'ملابس')],
    reference: 'ORD-42',
    metadata: ['cod' => 50],
));

echo $shipment->trackingNumber; // AWB

ShipBridge::driver('smsa')->createShipment(...); // addShip
ShipBridge::driver('smsa')->track('AWB');         // getTrack
ShipBridge::driver('smsa')->label('AWB');         // getPDF