alphazygma/usps-zonechart-php
Composer 安装命令:
composer require alphazygma/usps-zonechart-php
包简介
Provide zone identification between Source and Target Destination.
README 文档
README
USPS ZoneChart (for PHP)
Provide zone identification between Source and Target Destination
Requirements
PHP 5.5+ is required. (The [] short array syntax was introduced on 5.4, and GuzzleHttp 6 is not compatible with PHP 5.4)
Disclaimer
The ConfigGenerator and the helper tool to run the generator does not have unittests, however, since these are not intended for library use, but more for updating the JSON configuration files if USPS updates their charts because new ZipCodes are added to the US.
As such, these files are not included for test coverage purposes.
Changelog
- 1.0 Retrieve a Zone for a given source/destination ZipCodes
Usage
This usage considers that you have an autoloader running. (see Install for more reference)
<?php
$sourceZip1 = '94040'; // Mountain View, CA
$sourceZip2 = '40342'; // Lawrenceburg, KY
$destinationZip = '94118'; // San Francisco, CA
// Same or close zone example (CA -> CA)
$zoneChart = new \Shipping\ZoneChart\ZoneChart($sourceZip1);
$zoneA = $zoneChart->getZoneFor($destinationZip);
// $zoneA would have 1 or 2 for example
// different zone example (KY -> CA)
$zoneChart = new \Shipping\ZoneChart\ZoneChart($sourceZip2);
$zoneB = $zoneChart->getZoneFor($destinationZip);
// $zoneB would have 4 or 5 for example
Install
The easiest way to install is through composer.
Just create a composer.json file for your project:
{
"require": {
"alphazygma/usps-zonechart-php": "~1.0"
}
}
Then you can run these two commands to install it:
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install
or simply run composer install if you have have already installed the composer globally.
Then you can include the autoloader, and you will have access to the library classes:
<?php require 'vendor/autoload.php';
统计信息
- 总下载量: 728
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2016-11-03