aungmyokyaw/ip-api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aungmyokyaw/ip-api

最新稳定版本:v1.0.0

Composer 安装命令:

composer require aungmyokyaw/ip-api

包简介

IP-API for laravel package

README 文档

README

The Laravel IP-API Package is a powerful and easy-to-use solution for integrating IP geolocation functionality into your Laravel applications. With this package, you can effortlessly retrieve detailed information about the location, timezone, ISP, and more for any IP address. It provides a simplified interface for making API requests to IP-API, a popular and reliable IP geolocation service. Save time and effort in implementing IP geolocation in your Laravel projects with this convenient package.

Installation

composer require aungmyokyaw/ip-api

Usage

Features

  • Facade
  • Request

Facade

Retrieving geolocation data for a requested IP address.

use IPAPI;


$ipData = IPAPI::detect();

Retrieving geolocation data for a custom IP address.

use IPAPI;


$ipAddress = '192.168.1.1';

$ipData = IPAPI::detect($ipAddress);

Request

In your Laravel controller or middleware, you can use the $request->ipApi() method to retrieve geolocation data for the requested IP address. For example:

public function show(Request $request)
{

    $geoData = $request->ipApi(); // retrieve geolocation data 

}

Response

Available response data for this geo package includes:

Name Description Type
status success or fail string
message included only when status is fail Can be one of the following: private range, reserved range, invalid query string
continent Continent name string
continentCode Two-letter continent code string
country Country name string
countryCode Two-letter country code ISO 3166-1 alpha-2 string
region Region/state short code (FIPS or ISO) string
regionName Region/state string
city City string
district District (subdivision of city) string
zip Zip Code string
lat Latitude float
lon Longitude float
timezone Timezone (tz) string
offset Timezone UTC DST offset in seconds int
currency National currency string
isp ISP name string
org Organization name string
as AS number and organization, separated by space (RIR). Empty for IP blocks not being announced in BGP tables. string
asname AS name (RIR). Empty for IP blocks not being announced in BGP tables. string
reverse Reverse DNS of the IP (can delay response) string
mobile Mobile (cellular) connection bool
proxy Proxy, VPN or Tor exit address bool
hosting Hosting, colocated or data center bool
query IP used for the query bool

Credits

ip-api.com

License

This package is open source and released under the MIT License. Please review the LICENSE file for detailed licensing terms and conditions.

统计信息

  • 总下载量: 46
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-08