2017 © Pedro Peláez
 

library geocoder

A slim Google Geocoder for PHP and Laravel

image

rtablada/geocoder

A slim Google Geocoder for PHP and Laravel

  • Monday, July 1, 2013
  • by rtablada
  • Repository
  • 2 Watchers
  • 4 Stars
  • 150 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Build Status, (*1)

Geocoder

This is a simple geocode provider for PHP. By default, it uses google's geocode API but any compatible API will work., (*2)

Installation

This package can be installed using composer using composer require rtablada/geocoder., (*3)

For Laravel 4, this package and its Service Provider can be installed using php artisan package:install rtablada/geocoder., (*4)

On both, specify dev-master as the version constraint., (*5)

Use

To use this package outside of Laravel you can use, (*6)

require 'vendor/autoload.php';

$geocoder = new Rtablada\Geocoder\Geocoder;

var_dump($geocoder->getLocationFromQuery('Atlanta'));

The geocoder provides the following functions, (*7)

Function Arguments Description
getLocationFromQuery string Query Returns a Location Object from the google geocode API
getCoordinatesFromQuery string Query Returns a Coordinates Object from the google geocode API
getSearchSquare Coordinate center, number radius Returns an array with the corners of a sqare around the centerpoint with a radius in miles

Other Provided Classes

The Geocoder Package also provides two helper classes (Location and Coordinate)., (*8)

The Coordinate is a simple object with lat and lng properties., (*9)

The Location object has address and coordinates properties. The coordinates is an instance of the Coordinate class., (*10)

The Location class also provides a newInstanceFromObject method to parse Google Geocode Result objects into Location objects., (*11)

The Versions

01/07 2013

dev-master

9999999-dev

A slim Google Geocoder for PHP and Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel lpm