{"id":36987915,"url":"https://github.com/lybc/php-gb2260","last_synced_at":"2026-01-13T23:14:37.780Z","repository":{"id":62520639,"uuid":"103545045","full_name":"lybc/php-gb2260","owner":"lybc","description":"中华人民共和国国家标准 GB/T 2260 行政区划代码 php sdk","archived":false,"fork":false,"pushed_at":"2019-01-14T10:08:31.000Z","size":67,"stargazers_count":45,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-13T14:18:34.448Z","etag":null,"topics":["china-administrative-division","gb2260","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lybc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-14T14:49:01.000Z","updated_at":"2023-08-23T11:19:56.000Z","dependencies_parsed_at":"2022-11-02T14:00:34.669Z","dependency_job_id":null,"html_url":"https://github.com/lybc/php-gb2260","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/lybc/php-gb2260","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lybc%2Fphp-gb2260","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lybc%2Fphp-gb2260/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lybc%2Fphp-gb2260/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lybc%2Fphp-gb2260/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lybc","download_url":"https://codeload.github.com/lybc/php-gb2260/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lybc%2Fphp-gb2260/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405054,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["china-administrative-division","gb2260","php"],"created_at":"2026-01-13T23:14:37.271Z","updated_at":"2026-01-13T23:14:37.774Z","avatar_url":"https://github.com/lybc.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-gb2260\n\n中华人民共和国国家标准 GB/T 2260 行政区划代码 php 封装\n\n\n## Installing\n\n`composer require lybc/php-gb2260`\n\n## Usage\n```php\nuse Lybc\\PhpGB2260\\GB2260;\n\n$provinceAreaCode = 360000; // 江西省\n$cityAreaCode = 360300;     // 萍乡市\n$districtAreaCode = 360313; // 湘东区\n\n\n// 判断 code 是否省市区\nGB2260::areaCode($provinceAreaCode)-\u003eisProvince();\nGB2260::areaCode($provinceAreaCode)-\u003eisCity();\nGB2260::areaCode($provinceAreaCode)-\u003eisDistrict();\n\n// 根据 code 获取省市区名称\nGB2260::areaCode(360313)-\u003egetCurrent(); // 获取当前代码的名称\nGB2260::areaCode(360300)-\u003egetProvince(); // 根据市号获取所在省的名称\nGB2260::areaCode(360313)-\u003egetCity(); // 根据区号获取所在市的名称\nGB2260::areaCode(360313)-\u003egetDistrict(); // 根据区号获取名称\n\nGB2260::areaCode(360300)-\u003egetDistrict(); // 根据市号获取所有区的名称，为 code =\u003e name 的数组\n\n// 按照自定义格式输出\nGB2260::areaCode(360300)-\u003eformat('{p}, {c}, {d}'); // 输出江西省, 萍乡市, 湘东区, 只支持{p}/{c}/{d}\n\n$area = new GB2260(360300); // 等价于 GB2260::areaCode(360300)\n```\n\n## 采集 China GB2260 数据\n\n```shell\nphp ./scripts/cn.php 地址\n```\n\n\u003e 地址例如 http://www.mca.gov.cn/article/sj/tjbz/a/2017/201707/201708241433.html\n\u003e 则采集命令为 `php ./scripts/cn.php http://www.mca.gov.cn/article/sj/tjbz/a/2017/201707/201708241433.html`\n\n## License\n\nMIT\n\n## Thanks\n\n[package-builder @ overtrue](https://github.com/overtrue/package-builder)\n\n[gb2260](https://github.com/cn/GB2260)\n\n[gb2260.php](https://github.com/cn/GB2260.php)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flybc%2Fphp-gb2260","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flybc%2Fphp-gb2260","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flybc%2Fphp-gb2260/lists"}