eugenecooper / world-locations
允许检索全球所有国家、城市和地区
v0.1.3
2017-01-14 06:15 UTC
Requires
- php: ^5.6|^7.0
- vladkens/vk: 0.1.9
This package is auto-updated.
Last update: 2024-09-05 05:38:26 UTC
README
此简单包允许检索全球所有国家、某个国家的地区和城市等信息。代码依赖于vk.com公共API,因此如果您需要进行大量请求,您应该缓存结果或将它们保存到您的数据库中。
安装
通过 Composer
$ composer require eugenecooper/world-locations
用法
$locations = new \EugeneCooper\WorldLocations\Locations; // Obtain an array of all world's countries $locations->getCountries(); // Obtain an array of all country regions ($country_id can be obtained with the method above) $locations->getCountryRegions($country_id); // Obtain an array of all country cities $locations->getCountryCities($country_id); // Obtain an array of all country region's cities ($region_id can be obtained with methods above) $locations->getRegionCities($country_id, $region_id);
许可证
MIT 许可证 (MIT)。