jeroendesloovere / geolocation-bundle
This Geolocation Symony2 Bundle uses the geolocation-php-api class which finds latitude/longitude from an address or reverse using Google Maps API.
Installs: 18 148
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=5.3.3
- jeroendesloovere/geolocation-php-api: 1.2.*
- symfony/http-kernel: ~2.3
Requires (Dev)
- symfony/framework-bundle: ~2.3
This package is auto-updated.
Last update: 2024-10-24 03:58:49 UTC
README
This Geolocation Symony2 Bundle uses the geolocation-php-api class using Google Maps API which finds latitude/longitude from an address or reverse.
Usage
Installation
{ "require": { "jeroendesloovere/geolocation-bundle": "1.0.*" } }
Adding this code in your
composer.json
file will get the [latest :package_name Packagist package](https://packagist.org/packages/jeroendesloovere/geolocation-bundle using Composer.
and in app/AppKernel.php
public function registerBundles() { $bundles = array( // ..., new JeroenDesloovere\Bundle\GeolocationBundle\JeroenDesloovereGeolocationBundle() ); }
Example
$geolocation = $this->get('jeroendesloovere.geolocation'); // define result $result = $geolocation::getCoordinates('Koningin Maria Hendrikaplein', '1', 'Gent', '9000', 'belgiƫ'); // dump result echo 'Coordinates = ' . $result['latitude'] . ', ' . $result['longitude'] . '<br/>'; // define result: @return array(label, street, streetNumber, city, cityLocal, zip, country, countryLabel) $result = $geolocation::getAddress(51.0363935, 3.7121008); // define result echo 'Address = ' . $result['label'] . '<br/>';