Skip to content
This repository has been archived by the owner on Oct 9, 2018. It is now read-only.
/ geocoder Public archive

Simple Google Maps Geocoder PHP library

License

Notifications You must be signed in to change notification settings

biscolab/geocoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

*** NO LONGER MANTAINED ***

Replaced by Google Maps PHP SDK

Geocoder

Simple Google Maps Geocoder PHP library. Get Latitude and Longitude of selected address in few steps!

Installation

You can install the package via composer:

composer require biscolab/geocoder:^1.0

How to use

  1. Chose the address
$address = 'street <YOUR_STREET>, <YOUR_CITY>, <YOUR_COUNTRY>';
  1. Get location
$loc = (new Geocoder($address))->getLocation();
  1. Use data getLocation method returns a GeocoderLocation object. To retrieve latitude (Lat) and longitude (Lng) use the following methods:
/**
 * Return the latitude
 *
 * @return float
 */
$lat = $loc->getLat();

/**
 * Return the longitude
 *
 * @return float
 */
$lng = $loc->getLng();

That's it!