GeoIP

MaxMind GeoLite2-based geolocation. Country/region/city detection with user correction support and conditional content blocks.

GeoIP adds visitor location detection to ProcessWire with local MaxMind GeoLite2 databases, an optional IPGeolocation.io HTTPS fallback, user corrections, lookup history and template helpers for conditional content.

GeoIP

It is made for sites that need country-, region- or city-aware content, shipping choices, store finders, localized notices or a sensible location default without coupling templates to a specific lookup provider.

Author: Maxim Semenov
Website: smnv.org
Email: maxim@smnv.org

If this project helps your work, consider supporting future development: GitHub Sponsors or smnv.org/sponsor.

What GeoIP Does


  • Detects country, region, city, postal code, coordinates, continent and timezone.
  • Uses a local MaxMind GeoLite2 City or Country database first.
  • Can fall back to IPGeolocation.io over HTTPS when local lookup is unavailable.
  • Exposes $geoip in ProcessWire templates.
  • Includes inCountry(), inRegion(), inCity(), showIf() and getField() helpers.
  • Supports visitor-submitted location corrections.
  • Can cache results in the session and log one lookup per IP per session.
  • Provides an admin area for lookup history, corrections and manual IP lookup.

Installation


  1. Copy the GeoIP folder into /site/modules/.
  2. In ProcessWire Admin, refresh modules.
  3. Install GeoIP, then install ProcessGeoIP.
  4. For local lookup, install geoip2/geoip2 and add a GeoLite2 database as described in the documentation.
  5. Optionally enable the IPGeolocation.io fallback and enter an API key in the module settings.

Basic Usage


if ($geoip->inCountry('US')) {
    echo $page->us_content;
}

echo $geoip->showIf(
    'regionCode',
    ['PA', 'NJ', 'NY'],
    $page->northeast_banner,
    $page->national_banner
);

Local MaxMind lookup is preferred for speed and privacy. The HTTP fallback sends the visitor IP to IPGeolocation.io only when local lookup fails and the fallback is explicitly enabled.

Documentation


See DOCUMENTATION.md for requirements, setup, fallback configuration, API reference and integration examples.

See CHANGELOG.md for release notes.

License


MIT

More modules by Maxim Semenov

  • Context

    Export ProcessWire site context for AI development (JSON + TOON formats)
  • WireWall

    Advanced traffic firewall with VPN/Proxy/Tor detection, rate limiting, and JS challenge
  • Ichiban (SEO control center)

    Comprehensive SEO module: meta/OG/schema, audit, redirects, revisions, email reports.
  • Ally (a11y)

    Self-hosted accessibility widget powered by Sienna (MIT). Adds font, contrast, language, and navigation tools to any page. No external CDN — the JS bundle is served from your own server.
  • Subscribe

    Newsletter subscription handler with lists, double opt-in, honeypot, rate limiting and unsubscribe link.
  • Robots.txt

    Manage robots.txt file through the admin UI with presets and visual editor.
  • Dimensions

    Stores product dimensions (L×W×H) and weight with selectable units of measurement.
  • Squad

    AI integration for ProcessWire. Supports Anthropic, OpenAI, Google, xAI, and OpenRouter.
  • Rapid

    EditorJS block editor fieldtype for ProcessWire. Stores content as JSON, renders HTML server-side via pluggable block renderers.

All modules by Maxim Semenov

Install and use modules at your own risk. Always have a site and database backup before installing new modules.