PHPackages                             mtsung/mapsapi - 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. [API Development](/categories/api)
4. /
5. mtsung/mapsapi

ActiveLibrary[API Development](/categories/api)

mtsung/mapsapi
==============

Migrating from jyun/mapsapi

1.0.1(2y ago)05MITPHPPHP &gt;=8.1

Since Dec 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/MTsung/mapsapi)[ Packagist](https://packagist.org/packages/mtsung/mapsapi)[ Docs](https://github.com/mtsung/mapsapi)[ RSS](/packages/mtsung-mapsapi/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (5)Versions (3)Used By (0)

Maps API
========

[](#maps-api)

---

Migrating from [jyun/mapsapi](https://github.com/jyun790430/mapsapi)
--------------------------------------------------------------------

[](#migrating-from-jyunmapsapi)

Support Laravel 10

Installation
------------

[](#installation)

在專案中執行下方指令:

```
composer require mtsung/mapsapi
```

安裝好後即可在專案內使用 :

```
use Mtsung\Mapsapi\TwddMap\Geocoding;
```

---

Config
------

[](#config)

在專案中有使遇到 Mysql, Mongo, Map8, GoogleMap, 都須個別配置 .env 請參照:

`目前 Mongo 因為資料太多錯誤決定停止使用`

```
Mysql, Mongo        # 自行配置
MAPSAPI_GOOGLE_API_KEY=""     # 圖霸 KEY
MAPSAPI_MAP8_API_KEY=""   # Google API KEY
MAPSAPI_ENABLE_TWDD_MONGO=false
```

Usage
-----

[](#usage)

### Directions API

[](#directions-api)

```
use Mtsung\Mapsapi\TwddMap\Directions;

/**
 * Directions
 *
 * @param $origin
 * @param $destination
 * @param $mode ['driving', 'walking', 'bicycling'], default='driving'
 * @return array|mixed
*/
$directions = Directions::directions('25.0097038,121.4401783', '25.0108898,121.4346963');
```

### Geocoding API

[](#geocoding-api)

Source 順序:

- geocode: Map8 -&gt; GoogleMap (timeout = 2s)
- reverseGeocode: Mongo -&gt; Map8 -&gt; GoogleMap (timeout = 2s)

注意事項:

- Map8 超過台灣地區會回傳空值, 但設計上會繼續往 GoogleMap 查詢
- Source 查詢時可能回傳空值, 所以 zip, city\_id, district\_id 有可能為 null

```
use Mtsung\Mapsapi\TwddMap\Geocoding;

$geocode = Geocoding::geocode('台北市內湖區瑞光路335號');

$reverseGeocode = Geocoding::reverseGeocode('25.0396476673,121.505226616');
```

### API 統一回傳格式:

[](#api-統一回傳格式)

參數型別說明sourcestring來源: Mongo, Map8, GoogleMapcodeint按照 Http status: 200 為正常msgstring回傳說明dataarray若無資料則不回傳 Datatracearray若無追中錯誤則不回傳 trace

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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 ~42 days

Total

2

Last Release

895d 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 (3 commits)")

---

Tags

laravelMapsapi

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.0k](/packages/simplestats-io-laravel-client)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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