Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ziptastic/ziptastic-php-fluent

This is an ziptastic client for php using guzzle with two ways to use it.
https://github.com/ziptastic/ziptastic-php-fluent

forward geocode geodata gis guzzle postal-code reverse reverse-geocoding zipcode ziptastic ziptastic-php

Last synced: about 1 month ago
JSON representation

This is an ziptastic client for php using guzzle with two ways to use it.

Awesome Lists containing this project

README

        

# Ziptastic PHP with Guzzle

This package was brought into existence because of [this package](https://github.com/Ziptastic/ziptastic-php), specifically because of the [first enhancement](https://github.com/Ziptastic/ziptastic-php/issues/1)

This library is a [Guzzle](http://docs.guzzlephp.org/en/latest/) based interface for the [Ziptastic API](https://getziptastic.com/).

Using Ziptastic requires an API key, you can get one by signing up with Ziptastic.

## Installing

Ziptastic PHP can be installed via composer:

````
composer require ziptastic/fluent
````

## Usage

There are two different ways to use this package with the same end result.

The first way to use this is by using `Zipper` which will be using a more "plain english" oriented syntax
````php
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`

````php
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
````php
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.

Ziptastic PHP is licensed under the [MIT license](https://opensource.org/licenses/MIT/).