arxjei/psgc-php
最新稳定版本:v1.0.4
Composer 安装命令:
composer require arxjei/psgc-php
包简介
A PHP package for retrieving and managing Philippine Standard Geographic Code (PSGC) data, including regions, provinces, cities, and barangays.
README 文档
README
PSGC-PHP is a PHP package for handling Philippine Standard Geographic Code (PSGC) data. It provides tools to retrieve and search geographic information such as regions, provinces, cities, municipalities, and barangays from JSON files.
Features
- Access PSGC data from JSON files.
- Search address records using PSGC codes.
- Organized helper classes for file and lookup handling.
- Includes unit tests for each geographic level.
Installation
composer require arxjei/psgc-php
Get All Methods
| Address Type | Method | Description |
|---|---|---|
| Region | getRegions() | Get all regions. |
| Province | getProvinces() | Get all provinces. |
| City | getCities() | Get all cities. |
| Barangay | getBarangays() | Get all barangays. |
Get All By Code Methods
| Address Type | Method | Description |
|---|---|---|
| Province | getAllProvincesByRegionCode($region_code) | Provinces under a specific region. |
| City | getAllCitiesByProvinceCode($province_code) | Cities under a specific province. |
| Barangay | getAllBarangaysByCityCode($city_code) | Barangays under a specific city. |
Get By Code Methods
| Address Type | Method | Description |
|---|---|---|
| Region | getRegionsByCode($region_code) | Get a region by code. |
| Province | getProvincesByCode($province_code) | Get a province by code. |
| City | getCitiesByCode($city_code) | Get a city by code. |
| Barangay | getBarangaysByCode($barangay_code) | Get a barangay by code. |
Usage Examples
Get All Provinces
use Arxjei\PSGC; $provinces = PSGC::getProvinces(); print_r($provinces);
Get All Cities by Province Code
use Arxjei\PSGC; $cities = PSGC::getAllCitiesByProvinceCode('0128'); print_r($cities);
Get a Specific Barangay by Code
use Arxjei\PSGC; $barangay = PSGC::getBarangaysByCode('012801001'); print_r($barangay);
File Structure
src/- Core PHP logic.src/resources/json/- PSGC JSON data.tests/- PHPUnit tests.
Run Tests
vendor/bin/phpunit
License
MIT License.
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-07-31