2017 © Pedro Peláez
 

yii2-extension yii2-sypexgeo

Yii2 extension for Sypex Geo API (http://sypexgeo.net)

image

den67rus/yii2-sypexgeo

Yii2 extension for Sypex Geo API (http://sypexgeo.net)

  • Saturday, July 22, 2017
  • by den67rus
  • Repository
  • 1 Watchers
  • 1 Stars
  • 42 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 22 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

SypexGeo extension for Yii2

Yii2 extension for Sypex Geo API, (*1)

Sypex Geo - product for location by IP address. Obtaining the IP address, Sypex Geo outputs information about the location of the visitor - country, region, city, geographical coordinates and other in Russian and in English. Sypex Geo use local compact binary database file and works very quickly. For more information visit: http://sypexgeo.net/, (*2)

This Yii2 extension allow use Sypex Geo API in Yii2 application., (*3)

Usage

Once the extension is installed, simply use it in your code by :, (*4)

get();                // also returned geo data as array
    echo $geo->ip,'
'; echo $geo->ipAsLong,'
'; var_dump($geo->country); echo '
'; var_dump($geo->region); echo '
'; var_dump($geo->city); echo '
'; // get by custom IP $geo->get('212.42.76.252'); ?>

Information about country, region and city returned as array. For example:, (*5)


Country array ( 'id' => 222, 'iso' => 'UA', 'continent' => 'EU', 'lat' => 49, 'lon' => 32, 'name_ru' => 'Украина', 'name_en' => 'Ukraine', 'timezone' => 'Europe/Kiev', ), Region array ( 'id' => 709716, 'lat' => 48, 'lon' => 37.5, 'name_ru' => 'Донецкая область', 'name_en' => 'Donets\'ka Oblast\'', 'iso' => 'UA-14', 'timezone' => 'Europe/Zaporozhye', 'okato' => '14', ), City array ( 'id' => 709717, 'lat' => 48.023000000000003, 'lon' => 37.802239999999998, 'name_ru' => 'Донецк', 'name_en' => 'Donets\'k', 'okato' => '14101', ),

Update SypexGeo

For updates SypexGeo add the given code in cron, (*6)

updateDir = '/tmp';
    
    // Custom url update
    $geo->cityUrl = 'http://example.com/file.zip';
    $geo->countryUrl = 'http://example.com/file.zip';
    $geo->maxUrl = 'http://example.com/file.zip'; // Be sure to specify the url


    // Update Sypex Geo City file
    $geo->updateCity();
    
    // Update Sypex Geo Country file
    $geo->updateCountry();
    
    // Update Sypex Geo Max file
    // Be sure to specify the url $geo->maxUrl
    $geo->updateMax();
    
    // Update Sypex Geo all file
    // Be sure to specify the url $geo->maxUrl
    $geo->updateAll();
?>

Installation

The preferred way to install this extension is through composer., (*7)

Either run, (*8)

composer require den67rus/yii2-sypexgeo "~1.0.0"

or add, (*9)

"den67rus/yii2-sypexgeo": "*"

to the require section of your composer.json file., (*10)

The Versions

22/07 2017

dev-master

9999999-dev https://github.com/JiSoft/yii2-sypexgeo

Yii2 extension for Sypex Geo API (http://sypexgeo.net)

  Sources   Download

BSD-2-Clause

The Requires

 

by Avatar den67rus
by Avatar JiSoft
by zapimir

geoip yii2 geolocation geo sypexgeo

22/07 2017

1.0.0

1.0.0.0 https://github.com/JiSoft/yii2-sypexgeo

Yii2 extension for Sypex Geo API (http://sypexgeo.net)

  Sources   Download

BSD-2-Clause

The Requires

 

by Avatar den67rus
by Avatar JiSoft
by zapimir

geoip yii2 geolocation geo sypexgeo