Download the PHP package netresearch/contexts_geolocation without Composer
On this page you can find all versions of the php package netresearch/contexts_geolocation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download netresearch/contexts_geolocation
More information about netresearch/contexts_geolocation
Files in netresearch/contexts_geolocation
Package contexts_geolocation
Short Description Multi-channel contexts: Geolocation - Use the user's geographic location as context
License AGPL-3.0-or-later
Homepage https://www.netresearch.de
Informations about the package contexts_geolocation
Contexts: Geolocation for TYPO3
Geolocation-based context types for TYPO3. Show pages and content elements for visitors in specific countries, continents, or within a defined geographic area.
Uses MaxMind GeoIP2 for accurate IP-based location detection.
Features
- Country context: Target visitors from specific countries (ISO 3166-1 alpha-2 codes).
- Continent context: Target visitors from specific continents.
- Distance context: Target visitors within a radius from a geographic point.
- MaxMind GeoIP2: Uses the modern GeoIP2 library with GeoLite2 or commercial databases.
- Session caching: Efficient lookups with session-based caching.
- Proxy support: Uses the client IP address TYPO3 determines, so TYPO3's reverse proxy configuration applies.
Requirements
- TYPO3 12.4 LTS or 13.4 LTS
- PHP 8.2 or higher
- contexts extension:
^4.0 || ^5.0.1 || dev-mainwith Composer (composer.json), 4.x or 5.x for installations from TER (ext_emconf.php) - MaxMind GeoLite2-City database (free) or GeoIP2-City database (commercial)
Installation
Install via Composer:
Activate the extension:
MaxMind GeoLite2 Database Setup
This extension requires a MaxMind GeoIP2 database for IP geolocation.
1. Create a MaxMind Account
Sign up for a free account at MaxMind GeoLite2 Signup.
2. Download the Database
Download "GeoLite2 City" in MMDB format from your MaxMind account and extract it
to a location on your server (e.g., /var/lib/GeoIP/GeoLite2-City.mmdb).
Alternatively, use the geoipupdate tool for automatic updates:
3. Configure the Database Path
Set the environment variable:
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
GEOIP_DATABASE_PATH |
Path to the GeoIP2 database file | (required) |
Proxy Configuration
If your TYPO3 installation is behind a reverse proxy, configure the proxy in TYPO3 itself; the extension then uses the client address TYPO3 reads from X-Forwarded-For:
With 'last', TYPO3 takes the address the proxy appended, not one the visitor sent in its own X-Forwarded-For. Use 'first' only if the proxy replaces the header instead of appending to it.
Context Types
Continent Context
Matches visitors based on their continent:
- AF: Africa
- AN: Antarctica
- AS: Asia
- EU: Europe
- NA: North America
- OC: Oceania
- SA: South America
Country Context
Matches visitors based on their country using ISO 3166-1 alpha-2 codes (e.g., DE, US, FR, GB).
Distance Context
Matches visitors within a specified radius (in kilometers) from a geographic point defined by latitude and longitude.
Note: Distance-based targeting works best with larger radii (50+ km) due to the inherent limitations of IP-based geolocation accuracy.
Accuracy Considerations
IP-based geolocation has inherent limitations:
- Country detection: Generally very accurate (95%+).
- Continent detection: Very accurate (derived from country).
- City/coordinates: Accuracy varies significantly; often only accurate to the metropolitan area.
Visitors using VPNs, proxies, or mobile networks may be geolocated to different locations than their actual physical position.
Migration from v1.x
Version 2.0 is a complete rewrite with breaking changes:
- New GeoIP library: Uses MaxMind GeoIP2 instead of the legacy PECL geoip extension or PEAR Net_GeoIP.
- Environment configuration: Database path is now configured via environment variables instead of extension settings.
- PHP 8.2+ required: Modern PHP features and strict typing.
- TYPO3 12.4+ required: Drops support for TYPO3 11 and earlier.
Documentation
Full documentation is available at docs.typo3.org
(once published) or in the Documentation/ folder of this extension.
Security
What the extension does with visitor IP addresses, what it stores, and which security guarantees it gives and does not give is described in docs/SECURITY-ASSURANCE.md. Report vulnerabilities as described in SECURITY.md.
Contributing
Contributions are welcome! Please submit issues and pull requests on GitHub.
License
This extension is licensed under the AGPL-3.0-or-later.
Credits
Developed and maintained by Netresearch DTT GmbH.