PHPackages                             mtsung/twdd.location - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mtsung/twdd.location

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mtsung/twdd.location
====================

a taiwan location tool

1.1.0(4mo ago)12591MITPHPPHP &gt;=7.2

Since Dec 5Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/MTsung/twdd.location)[ Packagist](https://packagist.org/packages/mtsung/twdd.location)[ RSS](/packages/mtsung-twddlocation/feed)WikiDiscussions main Synced 6d ago

READMEChangelogDependencies (4)Versions (8)Used By (1)

台灣經緯度轉縣市工具
==========

[](#台灣經緯度轉縣市工具)

for Laravel &gt;= 6

Install
-------

[](#install)

```
composer require mtsung/twdd.location
```

Lumen
-----

[](#lumen)

`bootstrap/app.php` file:

```
$app->register(\Mtsung\TwddLocation\TwddLocationServiceProvider::class);
```

使用方式
----

[](#使用方式)

### 使用經緯度查詢縣市鄉鎮區

[](#使用經緯度查詢縣市鄉鎮區)

```
use Mtsung\TwddLocation\Facade\TwddLocation;

$res = TwddLocation::getCity(25.03375, 121.564879);
/*
array:2 [
  "city_code" => "63000"
  "city_name" => "臺北市"
]
*/

$res = TwddLocation::getDistrict(25.077741, 121.574829);
/*
array:4 [
  "city_code" => "63000"
  "city_name" => "臺北市"
  "district_code" => "63000100"
  "district_name" => "內湖區"
  "zip_code" => "114"
]
*/

$res = TwddLocation::getCity(34.92475,135.79863);
// null

$res = TwddLocation::getDistrict(39.256422, 140.986340);
// null
```

### 使用 zip code 或 district code 查詢鄉鎮區

[](#使用-zip-code-或-district-code-查詢鄉鎮區)

```
use Mtsung\TwddLocation\Facade\TwddDistrict;

$res = TwddDistrict::getInfoByZipCode(238);
/*
array:5 [
  "city_code" => "65000"
  "city_name" => "新北市"
  "district_code" => "65000070"
  "district_name" => "樹林區"
  "zip_code" => "238"
]
*/

$res = TwddDistrict::getInfoByZipCode(114);
/*
array:5 [
  "city_code" => "63000"
  "city_name" => "臺北市"
  "district_code" => "63000100"
  "district_name" => "內湖區"
  "zip_code" => "114"
]
*/

$res = TwddDistrict::getInfoByZipCode(9999);
// null

$res = TwddDistrict::getInfoByDistrictCode(67000300);
/*
array:5 [
  "city_code" => "67000"
  "city_name" => "臺南市"
  "district_code" => "67000300"
  "district_name" => "龍崎區"
  "zip_code" => "719"
]
*/

$res = TwddDistrict::getInfoByDistrictCode(9999);
// null
```

資料來源
----

[](#資料來源)

[直轄市、縣市界線](https://data.gov.tw/dataset/7442)

[鄉鎮市區界線](https://data.gov.tw/dataset/7441)

[3碼郵遞區號](https://data.gov.tw/dataset/37759)

License
-------

[](#license)

[MIT license](https://opensource.org/licenses/MIT)

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance76

Regular maintenance activity

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~249 days

Recently: every ~373 days

Total

7

Last Release

130d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ff790f37768052825d4d45c14834218eedbf240a48f90f3e6933ba4a69b05c7b?d=identicon)[MTsung](/maintainers/MTsung)

---

Top Contributors

[![MTsung](https://avatars.githubusercontent.com/u/31063480?v=4)](https://github.com/MTsung "MTsung (30 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mtsung-twddlocation/health.svg)

```
[![Health](https://phpackages.com/badges/mtsung-twddlocation/health.svg)](https://phpackages.com/packages/mtsung-twddlocation)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
