定制 shibanashiqc/dtdc-courier-php-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shibanashiqc/dtdc-courier-php-sdk

最新稳定版本:v1.1.0

Composer 安装命令:

composer require shibanashiqc/dtdc-courier-php-sdk

包简介

Dtdc unofficial php package

README 文档

README

Unofficial PHP library for DTDC.

Prerequisites

  • A minimum of PHP 8.0 is required.

Installation

  • If your project using composer, run the below command
composer require shibanashiqc/dtdc-courier-php-sdk
  • If you are not using composer, download the latest release from the releases section. You should download the dtdc-courier-php-sdk.zip file. After that, include DTDC.php in your application and you can use the API as usual.

##Note: This PHP library follows the following practices:

  • Namespaced under Shibanashiqc\DtdcCourierPhpSdk\
  • API throws exceptions instead of returning errors
  • Options are passed as an array instead of multiple arguments wherever possible
  • All requests and responses are communicated over JSON

Documentation

For Documentation of DTDC API you need contact DTDC Team

Basic Usage

Api Key , x_access_token and customer code credentials can be obtained from the DTDC.

Required parameters for the constructor are: api-key, x_access_token, customer_code

use Shibanashiqc\DtdcCourierPhpSdk\DTDC;
use Shibanashiqc\DtdcCourierPhpSdk\Config;

$client = new DTDC('your_api_key', 'your_access_token', false);
$client->setCustomerCode('customer_code');

Config::setShippingInfo([
    'customer_code' => $client::$customer_code,
    'service_type_id' => 'B2C PRIORITY',
    'load_type' => 'NON-DOCUMENT',
    'description' => 'Caddy DM48 Office Chair (Black)',
    'dimension_unit' => 'cm',
    'length' => '70.0',
    'width' => '70.0',
    'height' => '65.0',
    'weight_unit' => 'kg',
    'weight' => '17.0',
    'declared_value' => '5982.6',
    'num_pieces' => '1',
    'customer_reference_number' => '202424-135028',
    'cod_collection_mode' => '',
    'cod_amount' => '0',
    'commodity_id' => '99',
    'reference_number' => '',
]);

Config::setOriginDetails('TEST', '7894561230', '8766747774', '3/658  pillayar nagar karattur Amani kondalampatti', '', '676552', 'SALEM', 'Tamil Nadu');
Config::setDestinationDetails('TEST', '7844561230', '', '3/658  pillayar nagar karattur Amani kondalampatti', '', '636010', 'SALEM', 'Tamil Nadu');

Config::addPieceDetail([
    [
        'description' => 'Test Product',
        'declared_value' => '200',
        'weight' => '0.5',
        'height' => '5',
        'length' => '5',
        'width' => '5'
    ],
    // next piece detail can be added here
]);
    


$config = Config::$config;
$response = $client->base->createNewShipment($config);
print_r($response);

$response = $client->base->getShippingLabel('7X6548766');
print_r($response);

$response = $client->base->getTrackingStatus('7X6548766');
print_r($response);

createNewShipment

$config = Config::$config;
$response = $client->base->createNewShipment($config);
print_r($response);

getShippingLabel

$response = $client->base->getShippingLabel('7X6548766');
print_r($response);

getTrackingStatus

$response = $client->base->getTrackingStatus('7X6548766');
print_r($response);

cancelShipment

$response = $client->base->cancelShipment([
    "D78326386"
]);
print_r($response);

shippingAmount

// type of zone : City, Region, Zone, Metro, Rol-A
$response = $client->base->shippingAmount(50, 'City');
print_r($response);

getPincodeInfo

$response = $client->base->getPincodeInfo('676552', '600040');
print_r($response);

License

The DTDC PHP SDK is released under the MIT License. See LICENSE file for more details.

统计信息

  • 总下载量: 21
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: ISC
  • 更新时间: 2024-11-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固