sabartampubolon/geoip
Composer 安装命令:
composer require sabartampubolon/geoip
包简介
Simple Geo Location Information using IP Address
README 文档
README
Geo Ip took all available information from an Ip Address using data from GeoPlugin.
Work with Laravel 5.5 (tested).
Geo IP use Geoplugin to gather information.
Install
You can install GeoIp via composer.
$ composer require sabartampubolon/geoip
Requires Laravel Framework 5.5 and PHP 5.5.9 or newer. Visit GeoIp repository at Packagist.
Usage
To use GeoIp, you can simply inject GeoIp instance into Laravel controller
<?php use Sabartampubolon\Geoip\Geoip; // Use destination Ip $geoip = new Geoip('8.8.8.8'); // Or just let it blank to automatic use client ip address $geoip = new Geoip(); // Gather information from ip address $info = $geoip->getInfo();
The code above will give a result in json format like this (use IP Address 8.8.8.8):
{"ip_address":"8.8.8.8","country_code":"US","country_name":"United States","city":"Mountain View","region":"CA","region_name":"California","region_code":"CA","latitude":"37.3845","longitude":"-122.0881"}
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 34
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Pistarlabs
- 更新时间: 2016-04-11