大图广场/geo-location-data

此包的最新版本(v1.0.3)没有可用的许可证信息。

v1.0.3 2024-04-01 20:30 UTC

This package is auto-updated.

Last update: 2024-10-01 00:08:36 UTC


README

一个用于使用PHP显示国家、州、县和城市的JSON库。

注意:此包处于开发中,不应将ID值作为最终使用

用法

use Dantepiazza\GeoLocationData\Location;

$location = new Location();

// Regenerata a chache file
$location -> cache();

// Search locations by city name
$location -> search('Buenos Ai');

// Get location by city name
$location -> get(6344);

// Returns only the list of countries
$location -> countries();

// Get country by id
$location -> country('id', 11);

// Returns only the list of states
$location -> states();

// Get state by id
$location -> state(788);

// Returns only the list of counties in the country code
$location -> counties('AR');

// Get county by id
$location -> county('AR', 216);

// Returns only the list of cities in the country code
$location -> cities('AR');

// Get city by id
$location -> city('AR', 4867);

响应

位置数据
country_id: int
country_name: string
country_code: string
state_id: int
state_name: string
county_id: int
county_name: string
city_id: int
city_name: string
zip_code: string
name: string
国家数据
id: int
code: string
name: string
州数据
id: int
country_id: int
name: string
县数据
id: int
country_id: int
state_id: int
name: string
市数据
id: int
country_id: int
state_id: int
county_id: int
zip_code: string
name: string