LaravelPackages.net
Acme Inc.
Toggle sidebar
adiesel82/geoservice-laravel

SypexGeo Laravel 5.5 service

184
1
0.0.5
About adiesel82/geoservice-laravel

adiesel82/geoservice-laravel is a Laravel package for sypexgeo laravel 5.5 service. It currently has 1 GitHub stars and 184 downloads on Packagist (latest version 0.0.5). Install it with composer require adiesel82/geoservice-laravel. Discover more Laravel packages by adiesel82 or browse all Laravel packages to compare alternatives.

Last updated

adiesel82/geoservice-laravel

GeoIP Laravel 5.5 service

For the current moment SyperGeo service implemented only: https://sypexgeo.net

Plaese follow next steps for install:

1) add dependence:

composer require adiesel82/geoservice-laravel

2) add next items into config/app.php

'providers' => [
    ADiesel82\GeoService\GeoServiceProvider::class,
]
 
'aliases' => [
    'Geo' => ADiesel82\GeoService\GeoServiceFacade::class,
]

3) publish config with artisan:

php artisan vendor:publish

Type 0 to publish all or a digit near ADiesel82\GeoService\GeoServiceProvider

[8 ] Provider: ADiesel82\GeoService\GeoServiceProvider

It is 8 in example below and hit enter.

As result you can find geo.php in the config folder.

For the current moment SyperGeo service supported only.

Ready

Usage example:

$result = \Geo::get(\request()->ip());
dd($result);

As result:

{#129 ▼
  +"city": {#128 ▼
    +"id": 524901
    +"lat": 55.75222
    +"lon": 37.61556
    +"name_ru": "Москва"
    +"name_en": "Moscow"
  }
  +"country": {#130 ▼
    +"id": 185
    +"iso": "RU"
  }
}

Auto update database with composer

"post-install-cmd": [
  "ADiesel82\\GeoService\\ComposerScripts::postInstall"
],
"post-update-cmd": [
  "ADiesel82\\GeoService\\ComposerScripts::postUpdate"
],

Star History Chart