carloswph/ibgecode-php
Composer 安装命令:
composer require carloswph/ibgecode-php
包简介
Simple library to retrieve Brazilian city and respective state from the IBGE code.
README 文档
README
Simple library to retrieve Brazilian city and respective state from the IBGE code.
Installation
Just require the library using Composer composer require carloswph/ibgecode-php.
Usage
Simply autoload and instantiate the IBGE class - including an array of the searched codes as parameter. From the initial instance, the class admits methods to get the respective city, the state or both. All methods return an array of results.
use WPH\IBGE\IBGE; require __DIR__ . '/vendor/autoload.php'; $try = new IBGE(['5200050', '2300101', '99999999999']); $try->getCity(); // return an array of city names for each code $try->getState(); // return an array of state codes for those $try->getBoth(); // return an array of arrays, each with key-value pairs for cities and state codes
An additional chained method is available to return JSON, as follows.
$try = new IBGE(['5200050', '2300101', '99999999999']); $try->getCity(); // return an array of city names for each code $json = $try->toJson(); echo $json; // Results in: // [{"cidade":"Abadia de Goi\u00e1s","estado":"GO"},{"cidade":"Abaiara","estado":"CE"},["C\u00f3digo Inexistente."]] // The toJson() method admits the parameter true, which returns the JSON response in pretty print format.
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2021-02-05