Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Ip Location

Ip Location Laravel Package

gai871013/ip-location

A Laravel package for resolving IP addresses to geographic locations. Supports multiple data sources like QQWry, ip2region, and MaxMind, with a simple unified API for looking up country, province, city, and ISP details. Configurable drivers and caching make integration easy.

View on GitHub
Deep Wiki
Context7

ip-location,纯真IP地址库,composer包(解析QQWry.dat[纯真IP数据库])

Frequently asked questions about Ip Location
How do I install gai871013/ip-location in a Laravel app?
Install it with composer require gai871013/ip-location; the package is PSR-4 autoloaded. Check the README for whether a Laravel service provider is auto-discovered and whether configuration can be published with php artisan vendor:publish. If no provider is registered, wrap the parser in your own service class and bind it in a service provider.
Which Laravel and PHP versions does gai871013/ip-location support?
The package was released around May 2024, so it targets modern PHP, but read composer.json before adopting because the manifest may still pin PHP 8.0 or 8.1 or an older Laravel range. Confirm that mbstring and iconv are available in every runtime, including CI and container images, since QQWry data is stored in GBK.
Does gai871013/ip-location support IPv6 addresses?
QQWry.dat is an IPv4-only format, so IPv6 lookups will not resolve through the QQWry driver. The package blurb mentions MaxMind as another driver, which does support IPv6, but verify how the package handles IPv6 input and document a fallback. In your adapter, return null or a sentinel for IPv6 rather than letting it fail unpredictably.
Where does QQWry.dat come from, and do I need to bundle it with my app?
QQWry.dat is a separate binary artifact of roughly 10 to 20 MB and should not be committed blindly to your application repository. Decide explicitly whether to bundle it, download it during deploy, or mount it from a shared path, and make the path configurable via config and .env. Version the .dat file separately with a checksum so code and data can be rolled forward and back independently.
How do I look up country, province, city, and ISP for an IP address?
A typical call resolves an IPv4 string to country, province, city, and ISP fields through a unified API. QQWry stores Chinese strings in GBK, so UTF-8 output depends on iconv or mbstring conversion inside the package; test with known Chinese IPs and check for mojibake or replacement characters. Use an application-level GeoLocator interface rather than calling the package directly from controllers or models.
How do I update or refresh the 纯真 QQWry IP database?
The 纯真 database publishes updates on its own cadence, which is independent of this package's release cycle. Assign an operational owner and a scheduled job or deploy step that replaces the .dat file, verifies its checksum, and reloads any cached file handle. Treat data refresh as a separate pipeline from composer updates.
Does gai871013/ip-location cache lookups, and is it fast enough for production?
The package description mentions configurable drivers and caching, but confirm whether lookups are cached in memory, in Laravel's cache, or not at all. QQWry is a binary file that is either fully loaded per process or seeked per lookup; both are fast for moderate traffic, but a cache keyed by IP avoids repeated disk access. Benchmark with your expected request volume before relying on it.
What does gai871013/ip-location return for private, reserved, or invalid IP addresses?
This behavior is not documented in the package metadata, so verify what happens with 10.0.0.0/8, 127.0.0.1, and malformed strings before shipping. Decide in your adapter whether to short-circuit private and reserved ranges and return null instead of calling the parser. Never let an unparseable IP throw an unhandled exception in a request path.
Can I use gai871013/ip-location commercially given the QQWry license?
The MIT license covers the PHP code, not the QQWry or 纯真 database, which has its own free-for-non-commercial terms and redistribution caveats. A SaaS deployment may have more latitude than distributing a binary, but either way this is a legal review item. Confirm redistribution rights before bundling the .dat file in a distributed application.
How do I migrate from gai871013/ip-location to MaxMind GeoLite2 or ip2region later?
Wrap the package behind a GeoLocator interface with a single lookup(string $ip): ?Location method so swapping to MaxMind GeoLite2, ip2region, or a hosted API becomes a one-class change. Run both sources in parallel on sampled traffic before cutting over. Pin the package version and keep the data file versioned separately to make rollback straightforward.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console