Version: current

# Class Geoip

Routines for IP to country resolution.

Package: sapphire\misc
Located at sapphire/integration/Geoip.php

## Methods summary

`public static` | # `ip2country( string $address, boolean $codeOnly = false )` Find the country for an IP address. Find the country for an IP address. By default, it will return an array, keyed by the country code with a value of the country name. To return the code only, pass in true for the $codeOnly parameter. #### Parameters $address string $address The IP address to get the country of $codeOnly boolean $codeOnly Returns just the country code
`public static` | # `visitor_country( )` Returns the country code, for the current visitor Returns the country code, for the current visitor
`public static` | # `ip2country_check( )` Sanity Checker for this class, which helps us debug, or ensure that its working as expected Sanity Checker for this class, which helps us debug, or ensure that its working as expected
`public static null|string` | # `countryCode2name( mixed $code )` Returns the country name from the appropriate code. Returns the country name from the appropriate code. #### Returns `null|string` String if country found, null if none found
`public static` | # `getCountryDropDown( )` Returns an array of ISO Country Codes -> Country Names Returns an array of ISO Country Codes -> Country Names

### Magic methods summary

## Properties summary

`public static boolean` | $default_country_code | #
`protected static array` | $iso_3166_countryCodes | # ISO 3166 Country Codes ISO 3166 Country Codes Includes additional codes for Europe, Asia Pacific Region,Anonymous Proxies & Satellite Provider.

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -