Download the PHP package gilbertchiao/taiwan-county-city without Composer
On this page you can find all versions of the php package gilbertchiao/taiwan-county-city. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download gilbertchiao/taiwan-county-city
More information about gilbertchiao/taiwan-county-city
Files in gilbertchiao/taiwan-county-city
Download gilbertchiao/taiwan-county-city
More information about gilbertchiao/taiwan-county-city
Files in gilbertchiao/taiwan-county-city
Vendor gilbertchiao
Package taiwan-county-city
Short Description A PHP library for listing cities and counties in Taiwan, with their English names and other data.
License MIT
Homepage https://github.com/gilbertchiao/taiwan-county-city
Package taiwan-county-city
Short Description A PHP library for listing cities and counties in Taiwan, with their English names and other data.
License MIT
Homepage https://github.com/gilbertchiao/taiwan-county-city
Please rate this library. Is it a good library?
Informations about the package taiwan-county-city
台灣縣市資料 PHP 工具 (Taiwan City/County Data for PHP)
此專案提供一個簡單的方式,在 PHP 應用程式中取用台灣的縣市基本資料。資料來源為交通部運輸資料流通服務平臺 (TDX),並已預先處理成方便 PHP 直接使用的格式,無需每次都從資料庫查詢或解析 JSON 檔案。
安裝
您可以使用 Composer 來安裝此套件:
如何使用
根據您的 PHP 版本與偏好,選擇以下其中一種方式使用。
方法一:使用 Cities Class (通用)
這個方法適用於所有 PHP 版本,提供簡單的靜態方法來獲取資料。
範例:
方法二:使用 CityEnum (PHP 8.1+)
如果您使用 PHP 8.1 或更新版本,建議使用 Enum 以獲得更佳的型別安全與可讀性。
範例:
資料來源
所有資料皆來自交通部運輸資料流通服務平臺 (TDX) 的「全臺縣市代碼資料(City) v2」與「全臺縣市代碼資料(County) v2」。
- 原始資料位於
data/basic_city.json與data/basic_county.json。 - 合併後的完整資料為
data/city_county.json。
由於此資料不常異動,專案將其轉換為 PHP Class 或 Enum,以便在程式中更有效率地取用。
All versions of taiwan-county-city with dependencies
PHP Build Version
Package Version
Requires
php Version
^7.4 || ^8.0
The package gilbertchiao/taiwan-county-city contains the following files
Loading the files please wait ...