cimus/ip-geo-base
Определение страны, города, региона и координат по IP через базы ipgeobase.ru. Загружает архив, конвертирует текстовые базы в бинарный формат для быстрого поиска. Обновление данных удобно запускать по cron (например, раз в неделю).
| Risk Area | Mitigation Strategy |
|---|---|
| Database Bloat | Use SQLite for dev/testing; migrate to MySQL for prod with proper indexing. |
| Stale Data | Implement a cron job to auto-update the DB (package supports updates). |
| Accuracy | Validate against a third-party API (e.g., IPStack) for critical use cases. |
| Dependency Sprawl | Isolate to a single service; avoid mixing with business logic. |
| Licensing | Confirm IP2Location DB license terms (some require commercial licenses). |
Geo::country($ip) interface.user->location on created events.Request::ipGeo()).ip_from/ip_to columns for range queries.$geo = Cache::remember("geo:{$ip}", 3600, fn() => IpGeoBase::get($ip));
Artisan::call() to trigger updates:
php artisan ipgeobase:update
INET_ATON for IPv6 support.illuminate/support autoloader.null or default location).BETWEEN ip_from AND ip_to).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Database corruption | No geo lookups | Regular backups + automated tests. |
| Cache stampede | High DB load | Redis with proper TTLs. |
| Stale IP database | Inaccurate geo data | Auto-update cron + monitoring. |
| IPv6 unsupported | Missing 10% of traffic | Fork package or use hybrid solution. |
| IP2Location DB EOL | No updates | Migrate to alternative (e.g., MaxMind). |
How can I help you explore Laravel packages today?