sergenkabakci/delivery-module
最新稳定版本:1.0
Composer 安装命令:
composer require sergenkabakci/delivery-module
包简介
A module for calculating the delivery cost and delivery date for different delivery services
README 文档
README
A module for calculating the delivery cost and delivery date for different delivery services.
Installation
You can install the package using Composer:
composer required sergenkabakci/delivery-module
Usage
First, create an instance of the delivery service using the DeliveryServiceFactory class:
<?php
use Sergenkabakci\DeliveryModule\DeliveryServiceFactory;
$deliveryService = DeliveryServiceFactory::createDeliveryService('fast');
?>
You can then use the calculateCostAndDate method to calculate the delivery cost and delivery date:
<?php
$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";
}
?>
You can also use the DeliveryServiceAdapter class to convert the input data to a unified format:
<?php
use Sergenkabakci\DeliveryModule\DeliveryServiceAdapter;
$inputData = DeliveryServiceAdapter::adaptInputData('fast', '1234567890', '0987654321', 1.5);
$result = $deliveryService->calculateCostAndDate($inputData['sourceKladr'], $inputData['targetKladr'], $inputData['weight']);
?>
Supported Delivery Services
The following delivery services are currently supported:
Fast Delivery
Slow Delivery
License
This package is licensed under the MIT License
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-10-10