lithiumdev/larageo-plugin
Composer 安装命令:
composer require lithiumdev/larageo-plugin
包简介
A Laravel package that uses geoPlugin web service to fetch information from an IP.
关键字:
README 文档
README
Laravel 5+ Geo IP Package
from Lithium Hosting
We're always open to pull requests, feel free to make this your own or help us make it better.
Copyright
(c) Lithium Hosting, llc
License
This library is licensed under the MIT license; you can find a full copy of the license itself in the file /LICENSE
Requirements
- Laravel 5.2+
- php 5.5.9+
- Knowledge of Laravel and php
Description
A Laravel package that uses geoPlugin web service to fetch information from an IP. It will store in cache the IP information and it will expire in 1 week.
Installation
Install this package through Composer. To your composer.json file, add:
"lithiumdev/larageo-plugin": "~1.0"
Next, run the Composer update comand
$ composer update
Add the service provider to app/config/app.php, within the providers array.
'providers' => array( // ... LithiumDev\LaraGeo\ServiceProvider::class, ),
In the same file config/app.php add the alias:
'aliases' => array( //... 'LaraGeo' => LithiumDev\LaraGeo\Facade::class, ),
Usage
You can specify an IP:
$info = LaraGeo::getInfo('177.34.13.248'); // get info from a IP var_dump($info);
Or use it without any param:
$info = LaraGeo::getInfo(); // get info from the IP of the user accessing the page var_dump($info);
This is the output:
object(stdClass)[155] public 'geoplugin_request' => string '177.34.13.248' (length=13) public 'geoplugin_status' => int 200 public 'geoplugin_credit' => string 'Some of the returned data includes GeoLite data created by MaxMind, available from <a href=\'http://www.maxmind.com\'>http://www.maxmind.com</a>.' (length=145) public 'geoplugin_city' => string 'Campo Grande' (length=12) public 'geoplugin_region' => string 'Mato Grosso do Sul' (length=18) public 'geoplugin_areaCode' => string '0' (length=1) public 'geoplugin_dmaCode' => string '0' (length=1) public 'geoplugin_countryCode' => string 'BR' (length=2) public 'geoplugin_countryName' => string 'Brazil' (length=6) public 'geoplugin_continentCode' => string 'SA' (length=2) public 'geoplugin_latitude' => string '-20.450001' (length=10) public 'geoplugin_longitude' => string '-54.616699' (length=10) public 'geoplugin_regionCode' => string '11' (length=2) public 'geoplugin_regionName' => string 'Mato Grosso do Sul' (length=18) public 'geoplugin_currencyCode' => string 'BRL' (length=3) public 'geoplugin_currencySymbol' => string 'R$' (length=10) public 'geoplugin_currencySymbol_UTF8' => string 'R$' (length=2) public 'geoplugin_currencyConverter' => float 2.383
Another useful example: You can also just return one field, e.g. city from in one call:
$userCity = LaraGeo::getInfo()->geoplugin_city; // get the city from the user IP var_dump($userCity);
Output:
string 'Campo Grande' (length=12)
More info
If you want more info about the geoPlugin web service, click here.
lithiumdev/larageo-plugin 适用场景与选型建议
lithiumdev/larageo-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23.77k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2016 年 04 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「geoipPlugin」 「ipinfo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lithiumdev/larageo-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lithiumdev/larageo-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lithiumdev/larageo-plugin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
An IP address information display widget for Yii 2.0 with country flag and geo position info.
get ipinfo from ipipfreedb and qqwry.
Laravel geolocation with built-in fraud prevention, risk scoring, MFA triggers, IP blocking, threat intelligence, and security auditing. 6 providers (IP2Location.io, MaxMind, IpInfo, IpStack, IpApi, IpGeolocation), proxy/VPN/Tor detection, login tracking, timezone/currency personalization for Larave
Alfabank REST API integration
Get geo location by ip
统计信息
- 总下载量: 23.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-19