superdry/geolocation

Geolocation class that connects to Google Maps API

1.0.1 2019-03-13 14:12 UTC

This package is auto-updated.

Last update: 2024-09-14 03:23:32 UTC


README

Latest Stable Version

Table of Contents

Installation

Install Composer

$ php -r "readfile('https://getcomposer.org/installer');" | php && php composer.phar install
$ composer require superdry/geolocation

Then include Composer's generated vendor/autoload.php to enable autoloading:

Usage

require 'vendor/autoload.php';
use superdry\geolocation\GeolocationService;

example

getCoordinates

Get latitude/longitude coordinates from address.

$street = 'Koningin Maria Hendrikaplein';
$streetNumber = '1';
$city = 'Gent';
$zip = '1';
$country = 'belgium';
$geolocation = new GeolocationService();
$result = $geolocation->getCoordinates(
    $street,
    $streetNumber,
    $city,
    $zip,
    $country
);

getAddress

Get address from latitude/longitude coordinates.

$latitude = 51.0363935;
$longitude = 3.7121008;
$geolocation = new GeolocationService();
$result = $geolocation->getAddress(
    $latitude,
    $longitude
);

Maintainers

@SuperdryPlc.

License

MIT © SuperdryPlc