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
Geoip2 Bundle

Geoip2 Bundle Laravel Package

huluti/geoip2-bundle

Symfony bundle for MaxMind GeoIP2 that resolves IP addresses to geographic data such as country, city, and coordinates using local databases, with service integration for looking up visitor locations in applications.

View on GitHub
Deep Wiki
Context7

A Symfony bundle that integrates MaxMind GeoIP2 into your application, enabling IP-based geolocation with minimal setup. It provides ready-to-use services for querying GeoIP2 databases to determine country, city, and other location data from visitor IP addresses.

  • Seamless Symfony integration with service configuration
  • Supports GeoIP2 City and Country databases
  • Easy IP geolocation for country, city, coordinates, and more
  • Configurable database paths and locale
  • Lightweight and PSR-compatible
Frequently asked questions about Geoip2 Bundle
Can I use huluti/geoip2-bundle in a Laravel application?
No, not in any meaningful way. The package is a Symfony bundle whose entire job is dependency-injection glue: it registers MaxMind's reader as a Symfony service and compiles a YAML configuration tree, neither of which Laravel has. Composer will install it, but nothing in a Laravel bootstrap will call its extension class, so it does nothing at runtime.
What does huluti/geoip2-bundle actually do?
It is a thin wrapper around the official geoip2/geoip2 client library. It exposes configuration keys for the MMDB database path, a MaxMind license key, and a locale fallback chain, then wires a configured reader into the Symfony container. All the real work of parsing .mmdb files and resolving IP addresses to country, city, or coordinates is done by MaxMind's library, which is a separate dependency.
How do I install and configure the bundle in Symfony?
Install it with Composer alongside geoip2/geoip2, then register the bundle in your bundles.php and add a YAML block specifying the database path, license key, and locales. The bundle is a maintained fork of gpslab/geoip2 updated for newer Symfony and PHP versions, so it targets Symfony's bundle and configuration system specifically. Outside Symfony there is nothing to register it with.
How do I integrate MaxMind GeoIP2 into Laravel without this bundle?
Require geoip2/geoip2 directly, publish a small config file holding the database path and locale, and bind a singleton Reader instance in a service provider. Wrap it behind your own GeoLocator interface so the vendor is swappable and tests can substitute a stub. The whole integration is roughly one provider, one config file, and one binding, so a day or two including tests is realistic. Treat the Symfony bundle as a reference for which config keys matter, not as an installable dependency.
Which PHP and Laravel versions work with GeoIP2 lookups?
The bundle's Symfony version constraints are irrelevant to a Laravel app because you will not be using the bundle. What matters is geoip2/geoip2 and its maxmind-db/reader dependency running on your PHP version, which is fine on PHP 8.1 and above, including Laravel 10, 11, and 12. Pin the reader version explicitly rather than inheriting constraints from the bundle's lockfile, and confirm the MMDB format version, currently 2.0.
Do I need GeoLite2 or paid GeoIP2, and city, country, or ASN data?
Decide the data granularity first, because it drives both cost and database choice. Country-level lookups are usually fine with the free GeoLite2 databases, while city accuracy and stronger guarantees for fraud or geo-blocking decisions generally point at paid GeoIP2. If you only need network or ISP attributes, the ASN edition is a separate database again. Also check whether CDN or edge geo headers already give you what you need for free.
How often does the GeoLite2 database need updating?
MaxMind refreshes its databases weekly, and stale files degrade accuracy, so plan an automated download and atomic file swap on a schedule. In Laravel this is a scheduled command that fetches the archive, verifies it, and replaces the existing .mmdb without interrupting live lookups. No wrapper package, including this bundle, removes that operational obligation or MaxMind's licensing and attribution terms.
Is storing IP-derived geolocation data GDPR or CCPA compliant?
IP addresses are treated as personal data under GDPR and several other regimes, so derived location inherits similar obligations. Prefer resolving location at request time and persisting coarse, non-identifying fields rather than raw IPs, and set a retention policy with your legal team. MaxMind's attribution and redistribution terms also need a recurring review, owned by whoever holds the account and license key.
How do I test GeoIP2 lookups in Laravel without a real database?
Bind your own GeoLocator interface in the container and swap in a fake implementation in tests so no .mmdb file is required for most of the suite. For the adapter itself, use a small MaxMind test database committed as a fixture and assert against known IP ranges. This interface-first approach is the main reason to skip the Symfony bundle, since its Symfony-specific wiring is not stubbable from Laravel.
Is huluti/geoip2-bundle maintained, and what are the alternatives?
It is a single-maintainer fork with a very small footprint, one star, and no downstream dependents, so there is no community signal to surface regressions. The code surface is tiny and MIT licensed, which means it is forkable in an afternoon if upstream is abandoned, but it shows no evidence of production hardening. The practical alternative is to use geoip2/geoip2 directly, or a Laravel-oriented package such as torann/geoip, and keep the MaxMind reader pinned behind your own abstraction.
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.
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
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource