Download the PHP package formatd/geoip without Composer
On this page you can find all versions of the php package formatd/geoip. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download formatd/geoip
More information about formatd/geoip
Files in formatd/geoip
Package geoip
Short Description Neos integration for maxmind geoip2 client
License MIT
Informations about the package geoip
FormatD.GeoIP
A Neos CMS Integration for the geolocation service geoip2 api client of Maxmind (maxmind.com).
What does it do?
This package provides a service-class and eel-helper to access the geo-information of a user (by analyzing the IP address with the maxmind api). Optionally you can integrate a prompt to redirect the user to the content dimension matching his current location.
Compatibility
Versioning scheme:
1.0.0
| | |
| | Bugfix Releases (non breaking)
| Neos Compatibility Releases (non breaking except framework dependencies)
Feature Releases (breaking)
Releases und compatibility:
Package-Version | Neos CMS Version |
---|---|
1.0.x | 4.x |
1.1.x | 5.x |
1.2.x | 7.x, 8.x |
Using the service in you own plugins
Inject the IPLocalizationService into your class and call the method according to the maxmind endpoint (getCountry, getCity, getInsights). the corresponding model of the geoip2 library holding all available information is returned.
Using the service in fusion
To get de country iso code in lowercase call this eel-helper.
The eel-helper accepts an optional argument "key" (e.g. "continent.code") for direct access to the data provided by geoip2
Using the dimension switch prompt
To display a layer on your site telling the user to switch dimension if he is located somewhere else integrate this fusion prototype and place it where you need it.
-
Place fusion prototype where you want it in your site
-
Integrate LocationBasedDimensionSwitchPrompt.js into your site js bundling (it requires jQuery)
-
Configure the mapping (which iso code to what dimension value) in the Settings.yaml (see configuration)
- Make it pretty with css
Configuration options
Set your maxmind credentials in the Settings.yaml
For local testing you can enable debugging and simulate your ip address
To make the LocationBasedDimensionSwitchPrompt work you have to configure which iso code you want to redirect to which dimension value.
Calls to the API are cached for one day. You can modify the default lifetime in your Caches.yaml