-
Notifications
You must be signed in to change notification settings - Fork 0
Geolocation module for silverstripe. Uses the ipinfodb API. Gives more accurate IP to geolocation data than the SS geoip class. Register for a key at http://ipinfodb.com/register.php
lanks/Silverstripe-GeoLocator
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
To use this you must register for an api key at http://ipinfodb.com/register.php. Once you have an api key you can add it by putting this line into your _config.php file. GeoLocator::set_api_key('your_api_key'); If you are wanting dataobjects to have geolocation data then add this line to your _config.php. Object::add_extension('dataobjectclassname', 'LocationObject'); Example use from inside a 'Controller' //Get the IP Address $ipaddress = $this->getRequest()->getIP(); //Get the geolocation dataobject for this address $location = $this->getGeoLocation($ipaddress); $obj = new exampleObject(); //NOTE currently the line below here does not work. The dataobject ends up with a "0" as the "LocationID". $obj->LocationID = $location->ID; $obj->write();
About
Geolocation module for silverstripe. Uses the ipinfodb API. Gives more accurate IP to geolocation data than the SS geoip class. Register for a key at http://ipinfodb.com/register.php
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published