itech-ro/geolocation
Composer 安装命令:
composer require itech-ro/geolocation
包简介
Geolocation services for Laravel 5.x
README 文档
README
This package provides geolocation information including country, city, latitude and longitude based on request IP. There are a few available providers: Extreme IP Lookup, Free GeoIP, Geobytes and Geoplugin.
Instalation
Install the package using composer:
composer require itech-ro/geolocation
Edit app/config.php and add this line to providers array:
'providers' => [
...
Roitech\Geolocation\GeolocationServiceProvider::class,
...
];
Create a configuration file config/geolocation.php with the content:
<?php
return [
'provider' => 'geoplugin',
];
How to use it
Once you set the preferred provider in config/geolocation.php (possible values: geobytes, freegeoip, extremeiplookup, geoplugin) the geolocation details can be accessed using the Geolocation facade:
$coordinates = Geolocation::getCoordinates(); //returns an array [ 'lat' => LATITUDE, 'long' => LONGITUDE ]
$city = Geolocation::getCity();
$country = Geolocation::getCountry();
统计信息
- 总下载量: 26
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-01-27