jalle19 / geoipcountryprovider
与默认 GeoIP 数据库一起工作的 Geocoder GeoIP 提供商
1.0.0
2013-07-23 09:35 UTC
Requires
- php: >=5.3.0
- ext-geoip: *
- willdurand/geocoder: *
This package is auto-updated.
Last update: 2024-09-13 00:08:12 UTC
README
Geocoder GeoIP 提供商,与默认 GeoIP 数据库一起工作。这意味着您只需安装 php5-geoip
(或等效软件包),就可以使用此提供商确定访问者的国家。
使用方法
$geocoder = new \Geocoder\Geocoder(); $geocoder->registerProvider(new \GeoipCountryProvider\GeoipCountryProvider()); var_dump($geocoder->geocode('8.8.8.8')); // Output: // // object(Geocoder\Result\Geocoded)[55] // protected 'latitude' => int 0 // protected 'longitude' => int 0 // protected 'bounds' => null // protected 'streetNumber' => null // protected 'streetName' => null // protected 'cityDistrict' => null // protected 'city' => null // protected 'zipcode' => null // protected 'county' => null // protected 'countyCode' => null // protected 'region' => null // protected 'regionCode' => null // protected 'country' => string 'United States' (length=13) // protected 'countryCode' => string 'US' (length=2) // protected 'timezone' => null