2017 © Pedro Peláez
 

library ziptastic

PHP SDK for the Ziptastic Lookup API

image

ziptastic/ziptastic

PHP SDK for the Ziptastic Lookup API

  • Wednesday, June 22, 2016
  • by jdpedrie
  • Repository
  • 3 Watchers
  • 7 Stars
  • 3,961 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 3 Open issues
  • 2 Versions
  • 5 % Grown

The README.md

Ziptastic PHP

Latest Stable Version Build Status Test Coverage, (*1)

This library is a simple interface for the Ziptastic API., (*2)

Using Ziptastic requires an API key., (*3)

Installing

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

Usage

<?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

PHP 5

If you require PHP 5 compatibility, please use Ziptastic-PHP version 1., (*10)

License

Ziptastic PHP is licensed under the MIT license., (*11)

The Versions

22/06 2016

dev-master

9999999-dev

PHP SDK for the Ziptastic Lookup API

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by John Pedrie

17/12 2015

1.0

1.0.0.0

PHP SDK for the Ziptastic Lookup API

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by John Pedrie