PHPackages                             qbcloud/laravel-geoip2 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. qbcloud/laravel-geoip2

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

qbcloud/laravel-geoip2
======================

Query the geographical location by IP address.

2.0.0(1y ago)021MITPHPPHP &gt;=7.2.5

Since Jul 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/YQB520/qbcloud-laravel-geoip2)[ Packagist](https://packagist.org/packages/qbcloud/laravel-geoip2)[ RSS](/packages/qbcloud-laravel-geoip2/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

主要用途
----

[](#主要用途)

使用Laravel 6.x 以上通过Geoip2的GeoLite2 City、GeoLite2 ASN查询IP信息。

下载 GeoIP Databases 文件
---------------------

[](#下载-geoip-databases-文件)

PS：需要注册官方账号

文件放置路径
------

[](#文件放置路径)

```
storage/app/geoip
```

用法
--

[](#用法)

```
composer require qbcloud/laravel-geoip2
```

```
use QbCloud\Geoip2\Facades\IPQuery;

// 查询 ipv4 或者 ipv6
IPQuery::connect('x.x.x.x');

// 格式化地址
IPQuery::format(['中国', '广东', '广东']); // 中国-广东
IPQuery::format(['中国', '广东', '广州']); // 中国-广东-广州

// 查询IP类型
IPQuery::ipType('x.x.x.x'); // IPv4

// 查询是否是有效IP
IPQuery::isValid('x.x.x.x'); // false

// 或者
use QbCloud\Geoip2\IPQuery;

$client = new IPQuery();
$client->connect('2xx6:4xx0:0:1x3::a0');
```

### 官方文档

[](#官方文档)

[GeoIP2 and GeoLite2 Web Services Documentation](https://dev.maxmind.com/geoip/docs/web-services#request-and-response-api-references)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance47

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~283 days

Total

2

Last Release

397d ago

Major Versions

1.0.0 → 2.0.02025-04-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/702bf8a1771a16794a7ddb8d493b161e79a92fa99fe432950a2b7246c7775cd4?d=identicon)[YQB520](/maintainers/YQB520)

---

Top Contributors

[![YQB520](https://avatars.githubusercontent.com/u/76191566?v=4)](https://github.com/YQB520 "YQB520 (5 commits)")

---

Tags

laravelgeoipIPlocation

### Embed Badge

![Health badge](/badges/qbcloud-laravel-geoip2/health.svg)

```
[![Health](https://phpackages.com/badges/qbcloud-laravel-geoip2/health.svg)](https://phpackages.com/packages/qbcloud-laravel-geoip2)
```

###  Alternatives

[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[torann/geoip

Support for multiple Geographical Location services.

2.2k14.2M76](/packages/torann-geoip)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[adrianorosa/laravel-geolocation

Laravel Geo Location package to get details for a given IP Address

6593.3k1](/packages/adrianorosa-laravel-geolocation)[hibit-dev/geodetect

Automatically detect user's geo data based on their IP address

2319.5k](/packages/hibit-dev-geodetect)[gai871013/ip-location

纯真IP地址,composer包(解析QQWay.dat)

729.7k4](/packages/gai871013-ip-location)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
