webklex/laravel-geoip
Composer 安装命令:
composer require webklex/laravel-geoip
包简介
Laravel GeoIP client
README 文档
README
Description
Laravel-GeoIP provides you with the ability to gather open source ip intelligence by using the open api provided by GoGeoIP.
Table of Contents
Installation
1.) Install the Laravel-GeoIP package by running the following command:
composer require webklex/laravel-geoip
2.) If you're using Laravel >= 5.5, package discovery will configure the service provider and GeoIP alias out of the box.
Otherwise, for Laravel <= 5.4, edit your config/app.php file and:
- add the following to the
providersarray:
\Webklex\LaravelGeoIP\Providers\GeoIPServiceProvider::class,
- add the following to the
aliasesarray:
'GeoIP' => \Webklex\LaravelGeoIP\Facades\GeoIP::class,
3.) Run the command below to publish the package config file config/geoip.php:
php artisan vendor:publish --provider="Webklex\LaravelGeoIP\Providers\GeoIPServiceProvider"
Usage
Basic usage example
This is a basic example, which will dump the geoip information for the current user ip as well as for the ip "205.13.135.36".
use Webklex\LaravelGeoIP\Facades\GeoIP; var_dump(GeoIP::current()); var_dump(GeoIP::get("205.13.135.36"));
If you want to use your own instance of GoGeoIP, just update the endpoint provided in the config file.
Response:
{
"network": {
"ip": "208.13.138.36",
"as": {
"number": 209,
"name": "CenturyLink Communications, LLC"
},
"isp": "",
"domain": "",
"tld": [".us"],
"bot": false,
"tor": false,
"proxy": false,
"proxy_type": "",
"last_seen": 0,
"usage_type": ""
},
"location": {
"region_code": "NV",
"region_name": "",
"city": "Las Vegas",
"zip_code": "89129",
"time_zone": "America/Los_Angeles",
"longitude": -115.2821,
"latitude": 36.2473,
"accuracy_radius": 20,
"metro_code": 839,
"country": {
"code": "US",
"cioc": "USA",
"ccn3": "840",
"call_code": ["1"],
"international_prefix": "011",
"capital": "Washington D.C.",
"name": "United States",
"full_name": "United States of America",
"area": 9372610,
"borders": ["CAN", "MEX"],
"latitude": 39.443256,
"longitude": -98.95734,
"max_latitude": 71.441055,
"max_longitude": -66.885414,
"min_latitude": 17.831509,
"min_longitude": -179.23108,
"currency": [{
"code": "USD",
"name": ""
}, {
"code": "USN",
"name": ""
}, {
"code": "USS",
"name": ""
}],
"continent": {
"code": "",
"name": "North America",
"sub_region": ""
}
}
}
}
Support
If you encounter any problems or if you find a bug, please don't hesitate to create a new issue. However please be aware that it might take some time to get an answer. Off topic, rude or abusive issues will be deleted without any notice.
If you need immediate or commercial support, feel free to send me a mail at github@webklex.com.
A little notice
If you write source code in your issue, please consider to format it correctly. This makes it so much nicer to read and people are more likely to comment and help :)
``` php
echo 'your php code...';
```
will turn into:
echo 'your php code...';
Features & pull requests
Everyone can contribute to this project. Every pull request will be considered but it can also happen to be declined. To prevent unnecessary work, please consider to create a feature issue first, if you're planning to do bigger changes. Of course you can also create a new feature issue if you're just wishing a feature ;)
Change log
Please see CHANGELOG for more information what has changed recently.
Security
If you discover any security related issues, please email github@webklex.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
webklex/laravel-geoip 适用场景与选型建议
webklex/laravel-geoip 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 153 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 10 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「geoip」 「laravel」 「IP」 「webklex」 「laravel-geoip」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 webklex/laravel-geoip 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 webklex/laravel-geoip 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 webklex/laravel-geoip 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A GeoIP decorator/processor for monolog
Generic PDF merger for Laravel
Laravel IMAP client
PHP GeoIP client
pChart integration for frameworks such as Laravel and Symfony
Laravel IMAP client
统计信息
- 总下载量: 153
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-10-17