rtablada / geocoder
A slim Google Geocoder for PHP and Laravel
Requires
- php: >=5.3.0
- illuminate/support: 4.0.x
- shuber/curl: dev-master
Requires (Dev)
- mockery/mockery: dev-master
This package is not auto-updated.
Last update: 2024-12-02 14:58:27 UTC
README
Geocoder
This is a simple geocode provider for PHP. By default, it uses google's geocode API but any compatible API will work.
Installation
This package can be installed using composer using composer require rtablada/geocoder
.
For Laravel 4, this package and its Service Provider can be installed using php artisan package:install rtablada/geocoder
.
On both, specify dev-master
as the version constraint.
Use
To use this package outside of Laravel you can use
require 'vendor/autoload.php'; $geocoder = new Rtablada\Geocoder\Geocoder; var_dump($geocoder->getLocationFromQuery('Atlanta'));
The geocoder provides the following functions
Other Provided Classes
The Geocoder Package also provides two helper classes (Location and Coordinate).
The Coordinate is a simple object with lat
and lng
properties.
The Location object has address
and coordinates
properties. The coordinates
is an instance of the Coordinate class.
The Location class also provides a newInstanceFromObject
method to parse Google Geocode Result objects into Location objects.