maxmind / GeoIP2-php

PHP API for GeoIP2 webservice client and database reader
https://maxmind.github.io/GeoIP2-php/
Apache License 2.0
2.33k stars 276 forks source link

Missing country property, three letter country code #95

Closed hskrasek closed 7 years ago

hskrasek commented 7 years ago

Currently in the middle of upgrading away from the legacy geoip extension to this package and have run into an issue. In the past I could use geoip_country_code3_by_name to get the three letter country code for an IP address. Unless I am missing something, I cannot see a way to get that with these new API's.

Unfortunately we require the use of the three letter country code, so just the two letter country code won't work.

oschwald commented 7 years ago

The GeoIP2 databases do not provide three letter country codes. You could use a lookup table or a third party library such as league/iso3166 to convert the two-letter code to the three-letter code.

oschwald commented 7 years ago

Closing as this data is not provided by the database.

hskrasek commented 7 years ago

@oschwald Gotcha, wasn't even aware that league package existed. Gonna check that out and see how it goes. Thanks