wpdesk / ups-shipping-service
UPS 物流服务
3.2.2
2024-08-20 14:08 UTC
Requires
- php: >=7.0
- octolize/ups-rest-api-client: ^1.2
- psr/log: ^1.1
- wpdesk/ups-api: ^0.10.0
- wpdesk/wp-woocommerce-shipping: ^3.1.0
Requires (Dev)
- 10up/wp_mock: *
- mockery/mockery: *
- phpcompatibility/php-compatibility: ^9.1
- phpunit/phpunit: <7
- squizlabs/php_codesniffer: ^3.0.2
- wp-coding-standards/wpcs: ^0.14.1
- dev-master
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.2
- 3.1.1
- 3.1.0
- 3.1.0-beta1
- 3.0.3
- 3.0.2-beta1
- 3.0.1
- 3.0.0
- 3.0.0-beta5
- 3.0.0-beta4
- 3.0.0-beta3
- 3.0.0-beta2
- 3.0.0-beta1
- 2.13.1
- 2.13.0
- 2.12.0
- 2.11.1
- 2.11.0
- 2.10.2
- 2.10.1
- 2.10.1-beta2
- 2.10.1-beta1
- 2.10.0
- 2.9.4
- 2.9.3
- 2.9.2
- 2.9.1
- 2.9.1-beta1
- 2.9.0
- 2.9.0-beta1
- 2.8.2
- 2.8.1
- 2.8.0
- 2.8.0-beta1
- 2.7.4
- 2.7.3
- 2.7.2
- 2.7.1
- 2.7.0
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.1
- 2.6.0
- 2.5.1
- 2.5.0
- 2.4.3
- 2.4.2
- 2.4.2-beta1
- 2.4.1
- 2.4.1-beta9
- 2.4.1-beta8
- 2.4.1-beta7
- 2.4.1-beta6
- 2.4.1-beta5
- 2.4.1-beta4
- 2.4.1-beta3
- 2.4.1-beta2
- 2.4.1-beta1
- 2.4.0
- 2.3.10
- 2.3.9
- 2.3.8
- 2.3.7
- 2.3.7-beta4
- 2.3.7-beta3
- 2.3.7-beta2
- 2.3.7-beta1
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.2-beta2
- 2.3.2-beta1
- 2.3.1
- 2.3.1-beta1
- 2.3.0
- 2.3.0-beta3
- 2.3.0-beta2
- 2.3.0-beta1
- 2.2.0
- 2.2.0-beta1
- 2.1.0
- 2.1.0-beta1
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-feature/insured-value
This package is auto-updated.
Last update: 2024-09-20 14:20:05 UTC
README
UPS 物流服务
一个库,实现了 https://gitlab.com/wpdesk/predators/library/abstract-shipping 并使用 UPS API 连接来获取 UPS 物流实时运费。
需求
PHP 7.0 或更高版本。
通过 Composer 安装
为了通过 Composer 安装绑定,运行以下命令
composer require wpdesk/ups-shipping-service
示例用法
获取运输的 UPS 运费
<?php
/*
* @see https://gitlab.com/wpdesk/predators/library/abstract-shipping#creating-shipment-from-woocommerce-cart-contents
*/
$shipment = create_shipment();
$service_settings = new \WPDesk\AbstractShipping\Settings\SettingsValuesAsArray([
'user_id' => 'Your UPS user ID',
'password' => 'Your UPS password',
'access_key' => 'Your UPS access key',
'account_number' => 'Your UPS acount number',
]);
$rates = $service->rate_shipment($service_settings, $shipment);
print_r( $rates );