2017 © Pedro PelĆ”ez
 

library geocode

Google Geocoding API for Laravel 4 (fork jcf/geocode with updated guzzle)

image

dmitrymomot/geocode

Google Geocoding API for Laravel 4 (fork jcf/geocode with updated guzzle)

  • Thursday, November 26, 2015
  • by dmitrymomot
  • Repository
  • 1 Watchers
  • 2 Stars
  • 45 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 18 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Google Geocoding API for Laravel 4

Fork which requires new version guzzle

Latest Stable Version Total Downloads License, (*1)

A simple Laravel 4 service provider for Google Geocoding API., (*2)

Installation

This package can be installed via Composer by requiring the jcf/geocode package in your project's composer.json., (*3)

{
    "require": {
        "dmitrymomot/geocode": "1.0.*"
    }
}

Then run a composer update, (*4)

php composer.phar update

After updating composer, add the ServiceProvider to the providers array in app/config/app.php, (*5)

'Jcf\Geocode\GeocodeServiceProvider',

Add then alias Geocode adding its facade to the aliases array in the same file :, (*6)

'Geocode' => 'Jcf\Geocode\Facades\Geocode'

Usage

You can find data from addresses:, (*7)

$response = Geocode::make()->address('1 Infinite Loop');

if ($response) {
    echo $response->latitude();
    echo $response->longitude();
    echo $response->formattedAddress();
    echo $response->locationType();
}

// Output
// 37.331741
// -122.0303329
// 1 Infinite Loop, Cupertino, CA 95014, USA
// ROOFTOP

Or from latitude/longitude:, (*8)

$response = Geocode::make()->latLng(40.7637931,-73.9722014);
if ($response) {
    echo $response->latitude();
    echo $response->longitude();
    echo $response->formattedAddress();
    echo $response->locationType();
}

// Output
// 40.7637931
// -73.9722014
// 767 5th Avenue, New York, NY 10153, USA
// ROOFTOP

If you need other data rather than formatted address, latitude, longitude or location type, you can use the raw() method:, (*9)

$response = Geocode::make()->latLng(40.7637931,-73.9722014);
if ($response) {
    echo $response->raw()->address_components[8]['types'][0];
    echo $response->raw()->address_components[8]['long_name'];
}

// Output
// postal_code
// 10153

That's it. Pull requests are welcome., (*10)

The Versions

26/11 2015

dev-master

9999999-dev

Google Geocoding API for Laravel 4 (fork jcf/geocode with updated guzzle)

  Sources   Download

MIT

The Requires

 

by João Carlos

laravel api geocoding address latitude longitude google geocode

26/11 2015

1.0.1

1.0.1.0

Google Geocoding API for Laravel 4 (fork jcf/geocode with updated guzzle)

  Sources   Download

MIT

The Requires

 

by João Carlos

laravel api geocoding address latitude longitude google geocode

19/07 2014

1.0.0

1.0.0.0

A simple Laravel 4 service provider for Google Geocode API.

  Sources   Download

MIT

The Requires

 

by João Carlos

23/05 2014

0.0.1

0.0.1.0

A simple Laravel 4 service provider for Google Geocode API.

  Sources   Download

MIT

The Requires

 

by João Carlos