midnite81/geolocation
Composer 安装命令:
composer require midnite81/geolocation
包简介
A laravel package which wraps the IP Info DB and IP2Location Services
README 文档
README
A IP Info DB integration for Laravel
Versioning
| Version | Branch | PHP | Laravel | Notes |
|---|---|---|---|---|
| ^4.0 | master/v4 | >=8.1 | >=8 | Update to include wrap Ip2Location in addition to IpInfoDb, moved to php 8.1 |
| ^3.0 | v3 | >=7.4 | >=6 | Facade has been removed and guzzle dependency has been updated to version 7 |
| ^2.0 | v2 | >=5.6 | >=5 | Corrects issues with composer 2.0 |
| ^1.0 | v1 | >=5.6 | >=5 | First release - not compatible with composer 2.0 |
Upgrading to v4.0
Please note:
- version 4 brings in the ability to wrap both the IpInfoDb service (as was available in previous versions) and the Ip2Location service. IpInfoDb are not accepting new registrations and are asking users to register at Ip2Location instead.
- version 4 minimum requirements are php 8.1 to make use of the additional features php 8.1 brings, such as enums and better type safety.
- version 4 has an updated config file. If you are upgrading, I would suggest checking out the config file and updating your local instance of it.
- a change has been made to the caching from minutes to seconds.
Installation
If installing on anything below PHP 8.1, please checkout the v2 or v3 branch and follow the instructions on the readme for that branch. Please note ip2location is not supported on previous versions of this package
This package requires PHP 8.1+, and includes a Laravel Service Provider.
To install through composer include the package in your composer.json.
"midnite81/geolocation": "^4.0"
Run composer install or composer update to download the dependencies, or you can run
composer require midnite81/geolocation.
Laravel Integration
This package makes use of Laravel's auto package loader, so you shouldn't need to add this
to your config/app.php file. However, if you've disabled this then you'll need to add the
GeoLocation service provider to the list of service providers
in app/config/app.php.
'providers' => [
Midnite81\GeoLocation\GeoLocationServiceProvider::class
];
Publish the config and migration files using
php artisan vendor:publish --provider="Midnite81\GeoLocation\GeoLocationServiceProvider"
Configuration File
Once you have published the config files, you will find a geolocation.php file in the
config folder. You should look through these settings and update these where necessary.
Env
You will need to add the following to your .env file and update these with your own
settings. Please note you will only need to fill in the api key for the service you are using.
GEOLOCATION_IPINFODB_API_KEY=<ip_info_db_api_key> GEOLOCATION_IP2LOCATION_API_KEY=<ip2location_api_key> GEOLOCATION_CACHE=<duration_in_seconds>
Get your GeoLocation API Key
Before using this package you'll need to obtain an API Key from either IpInfoDb which is no longer accepting new registrations or Ip2Location.
Once you have signed up you will need to add your api key to the relevant .env key; GEOLOCATION_IPINFODB_API_KEY for
IpInfoDb or GEOLOCATION_IP2LOCATION_API_KEY for Ip2Location.
Caching
This package allows you to cache responses, however it is your responsibility to ensure you're not breaking any terms and conditions of use.
Rate Limiting
This package does not set any rate limiting internally. You should ensure that your application adheres to any rate limiting set by your chosen provider.
Example Usage and Available Methods and Properties
midnite81/geolocation 适用场景与选型建议
midnite81/geolocation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 25.43k 次下载、GitHub Stars 达 36, 最近一次更新时间为 2016 年 10 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sms」 「geolocation」 「laravel」 「location」 「ip2location」 「ipinfodb」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 midnite81/geolocation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 midnite81/geolocation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 midnite81/geolocation 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Maps in minutes. Powered by the Google Maps API.
The official PHP library for apiip.net that allowing customers to automate IP address validation and geolocation lookup in websites, applications and back-office system. Visit our API docs at https://apiip.net/documentation
Supports GeoIP services (sypexgeo.net).
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
Extensible library for building notifications and sending them via different delivery channels.
yii2-sms expand
统计信息
- 总下载量: 25.43k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 36
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-10-15