Ziptastic PHP with Guzzle
This package was brought into existence because of this package, specifically because of the first enhancement, (*1)
This library is a Guzzle based interface for the Ziptastic API., (*2)
Using Ziptastic requires an API key, you can get one by signing up with Ziptastic., (*3)
Installing
Ziptastic PHP can be installed via composer:, (*4)
composer require ziptastic/fluent
Usage
There are two different ways to use this package with the same end result., (*5)
The first way to use this is by using Zipper which will be using a more "plain english" oriented syntax, (*6)
in('US')->withPostalCode(48867)->andWithKey($key)->find();
echo $results->response;
?>
If that isn't your cup of tea or you just want to get things done, you can use Ziptastic, (*7)
setKey($key)->find();
echo $results->response;
?>
Using results
If you wanted to, you can access any and all of the results of the api call via calling the item you want from the api response.
The first way to use this is by using Zipper which will be using a more "plain english" oriented syntax, (*8)
in('US')->withPostalCode(48867)->andWithKey($key)->find();
echo $results->city, ', ',$results->state,' ',$results->postal_code;
?>
And in that example the only one set by default is the postal code, the others are from the response., (*9)
Ziptastic PHP is licensed under the MIT license., (*10)