hamidreza2005/php-ip
Composer 安装命令:
composer require hamidreza2005/php-ip
包简介
a package for get client's location by ip address in php
关键字:
README 文档
README
this package helps you to find client's location by IP address in PHP🚀
installation
you can install this package via Composer :
composer require hamidreza2005/php-ip
Usage
at first you must initialize your Driver:
use hamidreza2005\phpIp\Geojs; use hamidreza2005\phpIp\Ipinfo; use hamidreza2005\phpIp\Ipapi; $ip = new Geojs($DebugMode,$IP); //visit https://www.geojs.io/ $ip = new Ipapi(API_TOKEN,$DebugMode,$IP); // visit https://www.ipapi.com/ $ip = new Ipinfo(API_TOKEN,$JSON_FILE_PATH,$DebugMode,$IP); // visit https://www.ipinfo.io/
| Parameter | Explanation |
|---|---|
| API_TOKEN | your API Token |
| $JSON_FILE_PATH | See here |
| $DebugMode | if you ar in debug mode and use localhost make it true to get your current ip not 127.0.0.1 |
| $IP | you can use custom ip like 8.8.8.8 instead of using current ip |
and you can use driver's methods :
$ip->countryCode() // return country Code e.g DE $ip->all() // return all Details about client's ip $ip->coordinates() // return client's coordinates $ip->ip() // return all client's ip $ip->country() // return all client's country full name e.g Germany
Notice : because of every driver have different Structure you should use all method to access Details about IP
Get Country fullname in ipinfo driver
as you know there is not country fullname in ipinfo structure. so if want to use ipinfo driver and you want country fullname e.g France you can make a json file where you like and full $JSON_FILE_PATH like this :
<?php use hamidreza2005\phpIp\Ipapi; $ip = new Ipinfo(API_TOKEN,"./file/path.json")
and for example path.json file must be like this :
{
"US": "United State",
"DE": "Germany"
}
Now you can get country fullname by $ip->country() in ipinfo driver
License
The MIT License (MIT). Please see License File for more information.
🙋 Contributing
If you find an issue, or have a better way to do something, feel free to open an issue , or a pull request.
hamidreza2005/php-ip 适用场景与选型建议
hamidreza2005/php-ip 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 09 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「location」 「IP」 「get_location」 「php-ip」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hamidreza2005/php-ip 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hamidreza2005/php-ip 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hamidreza2005/php-ip 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
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
A Symfony2 Bundle to handle geographic location of your entities
A modern, feature-rich Laravel package for managing addresses with geocoding, validation, caching, and spatial operations. Perfect for e-commerce, CRM systems, and any application requiring robust address management.
Geonames importer and models for Eloquent ORM. This repo is a fork from Yurtesen/Geonames.
Alfabank REST API integration
Support for multiple GeoIP services.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-09-23