grmule/php-ziptastic
最新稳定版本:1.0.0
Composer 安装命令:
composer require grmule/php-ziptastic
包简介
A simple class for accessing the Ziptastic API (https://www.getziptastic.com/)
关键字:
README 文档
README
A simple PHP class used to access the Ziptastic API.
Sample usage:
$zt = new PHPZiptastic\Ziptastic(49504); print $zt->city; // Grand Rapids print $zt->lookup(34231)->city; // Sarasota print $zt->lookup(44870); // Bloomingville, OH print json_encode($zt); // {"city":"Bloomingville","state":"OH","zip":"44870"}
Errors and Exceptions
By default, errors (zip not found, malformed zip passed) will place a message in the $error property, and return a self-reference. This looks like:
print $zt->lookup(12344)->city; // null print $zt->error; // Invalid zip code
If you would like to catch an exception instead, pass TRUE as a second constructor parameter:
$zt = new Ziptastic(null, true); $zt->lookup(12344); // exception thrown here
OR
$zt = new Ziptastic(12344, true); // exception thrown here
For all errors, the exception throw is the base PHP Exception class.
Installation
Include Ziptastic.php or install the composer package.
Ziptastic
Ziptastic is a simple API that allows people to ask which Country,State and City are associated with a Zip Code.
More info at http://daspecster.github.com/ziptastic/
Many thanks to ElevenBaseTwo (http://blog.elevenbasetwo.com/) for shortening our forms!
统计信息
- 总下载量: 42
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-05