PHPackages                             marketo/silverstripe-regional - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. marketo/silverstripe-regional

AbandonedArchivedSilverstripe-module[Utility &amp; Helpers](/categories/utility)

marketo/silverstripe-regional
=============================

Using modern GeoIP lookup mechanisms, this SilverStripe module makes available the coordinates, postal code, city, state, country, content, timezone, organization, and ISP to the SilverStripe instance and can open a frontend API for static websites to take advantage of. It can be extended with GeoIP drivers to provide additional or custom contextual data.

41.3k11PHP

Since Feb 22Pushed 10y ago5 watchersCompare

[ Source](https://github.com/Marketo/SilverStripe-Regional)[ Packagist](https://packagist.org/packages/marketo/silverstripe-regional)[ RSS](/packages/marketo-silverstripe-regional/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (1)

Maintainer Contact
------------------

[](#maintainer-contact)

Kirk Mayo

&lt;kirk (dot) mayo (at) solnet (dot) co (dot) nz&gt;

Requirements
------------

[](#requirements)

- SilverStripe 3.2
- A driver to return the json/jsonp results

SilverStripe-Regional
=====================

[](#silverstripe-regional)

Using modern GeoIP lookup mechanisms, this SilverStripe module makes available the coordinates, postal code, city, state, country, content, timezone, organization, and ISP to the SilverStripe instance and can open a frontend API for static websites to take advantage of. It can be extended with GeoIP drivers to provide additional or custom contextual data.

Composer Installation
---------------------

[](#composer-installation)

composer require marketo/silverstripe-regional

Config
------

[](#config)

The current module uses a default path for the GeoIP database this is currently set to `/usr/share/GeoIP/GeoLite2-City.mmdb`This can be changed via the yml config a example is below. A model admin exists called GeoRegion which adds user defined fields to the result that is returned. It retrieves the details to add via the country code which needs to match a country code in GeoRegion.

```
IPInfoCache:
  GeoPath: '/your/own/location/yourdb.mmdb'

```

You can also return the results as json by setting up a variable in the yml config under IPInfoCache as per the example below, which also details how to specify the driver to use.

```
IPInfoCache:
  Driver: 'MarketoRegionalDriver'
  CORS: false
  jsonp: 'yourOwnJsonpFunction';
  GeoPathCity: '/usr/share/GeoIP/GeoIPCity.dat'

```

Another way to set the jsonp function is directly by using the get variable fn this will override anything set by the yml config file as per the following example url.

```
http://marketo.local/geoip/5.71.14.28.jsonp?fn=MarketoLoad

```

Accepting third party AJAX requests
-----------------------------------

[](#accepting-third-party-ajax-requests)

If you want to allow third party javascript requests to query the service (like AJAX) you will need to set the CORS flag in your yml config to true so that the `Access-Control-Allow-Origin` header gets sent back to the requesting browser as per the example below.

```
IPInfoCache:
  Driver: 'MarketoRegionalDriver'
  CORS: true
  jsonp: 'yourOwnJsonpFunction';
  GeoPathCity: '/usr/share/GeoIP/GeoIPCity.dat'

```

Querying the API from a third party can be done with jQuery or AJAX. A simple synchronous javascript example is below where you can just call the function requestInfo with the host and the request.

```
function requestInfo(host, request) {
    var xhr = new XMLHttpRequest();
    xhr.open("GET", host + request, false);
    xhr.send();

    return xhr.response;
}

// call with the following
// var result = requestInfo('http://192.168.0.1/', 'geoip/50.206.151.39.json');
```

You can also try the following asynchronous example below

```
function asyncRequestInfo(host, request) {
    var xhr = new XMLHttpRequest();
    xhr.open("GET", host + request, true);
    xhr.onload = function (e) {
    if (xhr.readyState === 4) {
        if (xhr.status === 200) {
            return xhr.responseText;
        } else {
            console.error(xhr.statusText);
        }
    }
    };
    xhr.onerror = function (e) {
        console.error(xhr.statusText);
    };
    xhr.send(null);
}

// call with the following
// var result = asyncRequestInfo('http://192.168.0.1/', 'geoip/50.206.151.39.json');
```

GeoIP database
--------------

[](#geoip-database)

You will neeed to retrive a databse for the module to work with this will need to be stored on the server and you may need to set the location of GeoPath under IPInfoCache in your config yml file. The free databases can be downloaded from here

API endpoints
-------------

[](#api-endpoints)

The curent endpoint returns a JSON object giving location details for the IP address. The results default to json but they can also be returned as jsonp if this has been defined under the config for IPInfoCache

```
http://YOURSITE/geoip/IPADDRESS
http://YOURSITE/geoip/IPADDRESS.json
http://YOURSITE/geoip/IPADDRESS.jsonp

```

TODO
----

[](#todo)

Add tests Split up conection methods make it easy to use other connectors and dbs

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e22e3bdb69c4e26df2afd309aa0e13d4366b29bf0446db5bba58866f8ab9985c?d=identicon)[nathanbrauer](/maintainers/nathanbrauer)

![](https://avatars.githubusercontent.com/u/681036?v=4)[Brandon Marshall](/maintainers/Brandon32)[@Brandon32](https://github.com/Brandon32)

![](https://avatars.githubusercontent.com/u/22066381?v=4)[Marketing Dev](/maintainers/marketingdev)[@MarketingDev](https://github.com/MarketingDev)

![](https://avatars.githubusercontent.com/u/17607967?v=4)[Jason Slavin](/maintainers/JasonHowellSlavin)[@JasonHowellSlavin](https://github.com/JasonHowellSlavin)

### Embed Badge

![Health badge](/badges/marketo-silverstripe-regional/health.svg)

```
[![Health](https://phpackages.com/badges/marketo-silverstripe-regional/health.svg)](https://phpackages.com/packages/marketo-silverstripe-regional)
```

###  Alternatives

[silverstripe/comments

Provides commenting functionality for your SilverStripe site.

40257.9k14](/packages/silverstripe-comments)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
