PHP code example of errogaht / delivery-aggregator

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

    

errogaht / delivery-aggregator example snippets


use Errogaht\DeliveryAggregator\Carrier\Dellin;
use Errogaht\DeliveryAggregator\Carrier\Jde;
use Errogaht\DeliveryAggregator\Carrier\Pec;
use Errogaht\DeliveryAggregator\Entity\Cargo;
use Errogaht\DeliveryAggregator\Entity\CargoItem;
use Errogaht\DeliveryAggregator\Entity\Transfer;
use Errogaht\DeliveryAggregator\ShippingManager;

$config = осток')
    ->setIsPickup(false);

$manager = new ShippingManager($config);
$manager->setCargo($cargo);
$manager->setTransfer($transfer);


$carrier = new Pec();
$carrierTransfer = $carrier->getCarrierTransfer();
$carrierTransfer->cargoIsHardPack = true;
$manager->addCarrier($carrier);



$carrier = new Dellin();
$carrierTransfer = $carrier->getCarrierTransfer();
$carrierTransfer->cargoIsHardPack = true;
$carrierTransfer->from = '7800000000000000000000000';
$manager->addCarrier($carrier);

$offers = $manager->calculate();
d($offers);