dev-master
9999999-devPHP SDK for the Ziptastic Lookup API
MIT
The Requires
- php >=5.4
The Development Requires
by John Pedrie
1.0
1.0.0.0PHP SDK for the Ziptastic Lookup API
MIT
The Requires
- php >=5.4
The Development Requires
by John Pedrie
Wallogit.com
2017 © Pedro Peláez
PHP SDK for the Ziptastic Lookup API
This library is a simple interface for the Ziptastic API., (*2)
Using Ziptastic requires an API key., (*3)
Ziptastic PHP can be installed via composer:, (*4)
composer require ziptastic/ziptastic
Ziptastic PHP relies on HTTPlug to make API requests. HTTPlug is an abstraction which allows you to choose from any one of a large number of HTTP clients, including the client you might already have installed., (*5)
For more information on getting started with HTTPlug, please refer to the HTTPlug for library users documentation., (*6)
To just get moving right now, install a couple common dependencies:, (*7)
composer require php-http/curl-client guzzlehttp/psr7 php-http/message
<?php
include "vendor/autoload.php";
use Ziptastic\Client;
$z = Client::create(getenv('ZIPTASTIC_API_KEY'));
Ziptastic provides two API methods: Lookup by a postal code (forward lookup), and lookup by latitude and longitude (reverse lookup)., (*8)
$result = $z->forward(48038); $result = $z->reverse(42.331427, -83.0457538, 1000);
Results are returned as a list of arrays:, (*9)
<?php $lookup = current($result); echo $lookup['county']; // Macomb echo $lookup['city']; // Clinton Township echo $lookup['state']; // Michigan echo $lookup['state_short']; // MI echo $lookup['postal_code']; // 48038 echo $lookup['latitude']; // 42.5868882 echo $lookup['longitude']; // -82.9195514 // Timezones are represented by an instance of \DateTimeZone echo $lookup['timezone']->getName(); // America/Detroit
If you require PHP 5 compatibility, please use Ziptastic-PHP version 1., (*10)
Ziptastic PHP is licensed under the MIT license., (*11)
PHP SDK for the Ziptastic Lookup API
MIT
PHP SDK for the Ziptastic Lookup API
MIT