jberall/getlatlng

takes an address array and returns a latitude, longitude and latlng in an array

Installs: 25

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2017-05-16 22:09 UTC

This package is not auto-updated.

Last update: 2024-11-09 20:39:45 UTC


README

Takes an address array and return an array of latitude, longitude and latlng

Installation

The preferred way to install this extension is through composer.

You also need to install composer require wenbin1989/yii2-curl:dev-master or add "wenbin1989/yii2-curl": "dev-master"

Either run

composer require jberall/getlatlng:dev-master 

or add

"jberall/getlatlng": "dev-master"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

<?php 
        $arrAdd = [
            'address' => '3555 Farnam Street',
            'city' => 'Omaha',
            'province' => 'NB',
            //or 
//            'state' => 'NB',

            'country' => 'CA',
            'postal_code' => '68131',
//          or 
//          'zip' => '68131',
        ];    

//you will need to initilize the class so we can reference the google key.
use jberall\getlatlng\GetLatLng;

    $latlng = new GetLatLng();
    $arrLatLng = $latlng->getLatLngGoogle($this->toArray());
    $this->latlng = $arrLatLng['latlng'] ?? null;
?>