Sorbing / sypex-geo-laravel by Sorbing

The Sypex Geo PHP Class Wrapper for Laravel 4.2
66
0
1
Package Data
Maintainer Username: Sorbing
Maintainer Contact: svbutsenko@gmail.com (Stanislav Butsenko)
Package Create Date: 2015-03-30
Package Last Update: 2015-04-03
Language: PHP
License: MIT
Last Refreshed: 2024-11-15 15:17:28
Package Statistics
Total Downloads: 66
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

The SypexGeo Laravel 4.x Package

Determine the City and Country info by IP address.

Installation

Require the package via composer:

composer require sorbing/sypex-geo-laravel

Or specify manually the package in require section in composer.json:

"sorbing/sypex-geo-laravel": "dev-master"

.. and run:

composer update

Register the Service Provider in providers array in app/config/app.php:

'Sorbing\SypexGeoLaravel\SypexGeoLaravelServiceProvider',

Use the following config in composer.json for install SxGeoCity.dat database:

"scripts": {
    "post-update-cmd": [
        "IgI\\SypexGeo\\Composer::installDatabases"
    ]
},
"extra": {
    "sypexgeo_remote": "https://sypexgeo.net/files/SxGeoCity_utf8.zip",
    "sypexgeo_local": "app/database/SxGeoCity.dat"
}

Usage

Usage the sypexgeo service from IoC:

/** @var \Sorbing\SypexGeoLaravel\SypexGeoService $sypexGeo */
$sypexGeo = \App::make('sypexgeo');

/** @var \Sorbing\SypexGeoLaravel\Wrappers\GeoDataWrapper $geoData */ 
$geoData = $sypexGeo->get('1.2.3.4');

echo $geoData->city->nameRu;