PHP code example of mohamedhekal / shipbridge-hepsijet

1. Go to this page and download the library: Download mohamedhekal/shipbridge-hepsijet 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-hepsijet 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('hepsijet')->createShipment(new CreateShipmentRequest(
    origin: new Address('Depo', 'Sanayi Cd 1', 'İstanbul', 'TR', state: 'Tuzla', phone: '05551111111'),
    destination: new Address('Ali Yılmaz', 'Kızılay Mah.', 'Ankara', 'TR', state: 'Çankaya', phone: '05551234567', email: '[email protected]'),
    parcels: [new Parcel(weightKg: 2.0, description: 'Ayakkabı')],
    reference: 'ORD-42',
    metadata: ['desi' => 2, 'town' => 'Çankaya'],
));

echo $shipment->trackingNumber; // TSTORD42...