2017 © Pedro Peláez
 

library sypexgeo

A PHP package for working with the SypexGeo database file.

image

eseath/sypexgeo

A PHP package for working with the SypexGeo database file.

  • Sunday, April 22, 2018
  • by Ruslan A.
  • Repository
  • 2 Watchers
  • 2 Stars
  • 753 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 18 % Grown

The README.md

SypexGeo PHP API

Minimum PHP Version Latest stable version Build Status, (*1)

A PHP package for working with the SypexGeo database file., (*2)

The current version supports Laravel 5.1 and later., (*3)

Installation

composer require eseath/sypexgeo

For non-Laravel projects, you need to manually download the database file:, (*4)

The database is updated 2 times a month., (*5)

Setup

Laravel

1. If Laravel version <= 5.4, add into config/app.php:, (*6)

    'providers' => [
        \Eseath\SxGeo\SxGeoServiceProvider::class,
    ]

2. Publish config sxgeo.php (optionally):, (*7)

php artisan vendor:publish --provider="Eseath\SxGeo\SxGeoServiceProvider"

By default, in config specified URL to the database of cities. If you want the database of countries, change url:, (*8)

...
    'dbFileURL' => 'https://sypexgeo.net/files/SxGeoCountry.zip',
...

3. Download the database file:, (*9)

php artisan sxgeo:update

You can use this command to upgrade database to the current version via CRON., (*10)

Usage

use Eseath\SxGeo\SxGeo;

$sxGeo = new SxGeo('/path/to/database/file.dat');
$fullInfo  = $sxGeo->getCityFull($ip);
$briefInfo = $sxGeo->get($ip);

With Laravel

use SxGeo;

$data = SxGeo::getCityFull($ip);

Example Data

array:3 [▼
    "city" => array:5 [▼
        "id" => 524901
        "lat" => 55.75222
        "lon" => 37.61556
        "name_ru" => "Москва"
        "name_en" => "Moscow"
    ]
    "region" => array:4 [▼
        "id" => 524894
        "name_ru" => "Москва"
        "name_en" => "Moskva"
        "iso" => "RU-MOW"
    ]
    "country" => array:6 [▼
        "id" => 185
        "iso" => "RU"
        "lat" => 60
        "lon" => 100
        "name_ru" => "Россия"
        "name_en" => "Russia"
    ]
]
array:2 [▼
    "city" => array:5 [▼
        "id" => 524901
        "lat" => 55.75222
        "lon" => 37.61556
        "name_ru" => "Москва"
        "name_en" => "Moscow"
    ]
    "country" => array:2 [▼
        "id" => 185
        "iso" => "RU"
    ]
]

Running Tests

The tests are run automatically by Travis CI on multiple PHP and Laravel versions., (*11)

If you want to run tests locally, use the following command:, (*12)

python3 ./test.py

Development

docker-compose run php-7.1 composer install

The Versions

22/04 2018

dev-master

9999999-dev

A PHP package for working with the SypexGeo database file.

  Sources   Download

MIT

The Requires

  • php ^7.0
  • ext-curl *
  • ext-zip *

 

The Development Requires

by Avatar Ruslan A.

laravel geoip geo sypexgeo sxgeo

22/04 2018

v2.0.0

2.0.0.0

A PHP package for working with the SypexGeo database file.

  Sources   Download

MIT

The Requires

  • php ^7.0
  • ext-curl *
  • ext-zip *

 

The Development Requires

by Avatar Ruslan A.

laravel geoip geo sypexgeo sxgeo

26/02 2018

1.1.0

1.1.0.0

A PHP package for working with the SypexGeo database file.

  Sources   Download

MIT

The Requires

  • php >=5.6.4
  • ext-curl *
  • ext-zip *

 

The Development Requires

by Avatar Ruslan A.

laravel geoip geo sypexgeo sxgeo

26/02 2018

1.0.x-dev

1.0.9999999.9999999-dev

A PHP package for working with the SypexGeo database file.

  Sources   Download

MIT

The Requires

  • php >=5.6.4
  • ext-curl *
  • ext-zip *

 

The Development Requires

by Avatar Ruslan A.

laravel geoip geo sypexgeo sxgeo

02/02 2017

v1.0.0

1.0.0.0

A PHP package for working with the SypexGeo database file.

  Sources   Download

MIT

The Requires

  • php >=5.6.4
  • ext-curl *
  • ext-zip *

 

The Development Requires

by Avatar Ruslan A.

laravel geoip geo sypexgeo sxgeo