PHP code example of sergenkabakci / delivery-module

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

    

sergenkabakci / delivery-module example snippets



use Sergenkabakci\DeliveryModule\DeliveryServiceFactory;
$deliveryService = DeliveryServiceFactory::createDeliveryService('fast');




$result = $deliveryService->calculateCostAndDate('1234567890', '0987654321', 1.5);
if ($result['error']) {
    echo "Error: " . $result['error'];
} else {
    echo "Price: " . $result['price'] . "\n";
    echo "Date: " . $result['date'] . "\n";
}


use Sergenkabakci\DeliveryModule\DeliveryServiceAdapter;

$inputData = DeliveryServiceAdapter::adaptInputData('fast', '1234567890', '0987654321', 1.5);

$result = $deliveryService->calculateCostAndDate($inputData['sourceKladr'], $inputData['targetKladr'], $inputData['weight']);