PHPackages                             hosomikai/laravel-ezship - 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. hosomikai/laravel-ezship

ActiveLibrary

hosomikai/laravel-ezship
========================

台灣便利配ezship物流API

1.0.0(4y ago)2891MITPHPPHP ^7.0|^8.0

Since Jun 14Pushed 4y ago1 watchersCompare

[ Source](https://github.com/HosomiKai/laravel-ezship)[ Packagist](https://packagist.org/packages/hosomikai/laravel-ezship)[ Docs](https://github.com/HosomiKai/laravel-ezship)[ RSS](/packages/hosomikai-laravel-ezship/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

 [ ![](https://camo.githubusercontent.com/0e2858e25a27ffa93df9c63f7be46cd67a26db7cab2d49cac567548bd67f8ca4/68747470733a2f2f7777772e657a736869702e636f6d2e74772f696d616765732f6c6f676f2d657a73686970322e676966) ](https://www.ezship.com.tw/service_doc/service_home_w18v1.jsp?vDocNo=1702&vDefPage=04)

Laravel Ezship Api - 台灣便利配非官方套件
===============================

[](#laravel-ezship-api---台灣便利配非官方套件)

Made with ❤️ by [hosomikai](https://github.com/HosomiKai)

---

Requirement for laravel
-----------------------

[](#requirement-for-laravel)

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

[](#installation)

### 1. Require the Package

[](#1-require-the-package)

After creating your new Laravel application and composer setting, you can include the package with the following command:

```
$ composer require hosomikai/laravel-ezship
```

### 2. Publish

[](#2-publish)

```
php artisan vendor:publish --provider="Hosomikai\Ezship\EzshipServiceProvider"
```

### 3. Add your `.env` :

[](#3-add-your-env-)

```
EZSHIP_APP_ID={YOUR_EZSHIP_APP_ID}
EZSHIP_RETURN_URL=${APP_URL}/ezship
EZSHIP_MAP_REDIRECT_URL=${APP_URL}/ezship_map

```

如果你想載入demo範例 `config/app.php`

```
'providers' => [
    ...
    Hosomikai\Ezship\EzshipDemoServiceProvider::class,
]

```

設定完成後瀏覽 `http://localhost:8000/ezship/order`

Usage
-----

[](#usage)

### 1. 設定回傳網址

[](#1-設定回傳網址)

`routes/web.php`

```
    Route::get('ezship', 'EzshipController@handle');

```

註：需將你的ezship 路由網址註冊到 VerifyCsrfToken middleware 裡的 $except裡，以過濾post方法

`EzshipController:`

```
    use Illuminate\Http\Request;
    use Hosomikai\Ezship\EzshipResponse;

    ...

    public function handle(Request $request)
    {
        $response = new EzshipResponse($request->all());

        //your handle or just default
        //you can redirect your handle page or
        //if you use api to get this response
        //just return response object

        return $response;
    }

```

### 2. 宅配串接

[](#2-宅配串接)

```
    use Ezship
    ...

    $orderId = now()->format('YmdHis');                     //商店訂單編號
    $amount = 100;                                          //包裹價值金額或代收金額
    $needPay = true;                                        //是否需要代收款(取貨付款或單純取貨)
    $recipientName = 'hosomikai';                           //取貨人或收件人姓名(需與收件人證件姓名一致)
    $recipientEmail = 'service@hosomikai.com';              //取貨人或收件人信箱
    $recipientMobile = '0953539459';                        //取貨人或收件人電話
    $zipCode = '104';                                       //收貨人郵遞區號
    $recipientAddr = '12, No. 80號復興北路中山區台北市104';     //收貨人地址

    $order = Ezship::newOrder($amount, $needPay, $orderId)
                ->recipient($recipientName', $recipientMobile, $recipientEmail')
                ->homeDelivery($zipCode, $recipientAddr);

    //post by redirect form
    return $order->checkout();

```

### 3. 超商取貨串接

[](#3-超商取貨串接)

產生電子地圖連結:

```
    use Hosomikai\Ezship\EzshipMapGenerator;

    //你想夾帶回來的參數
    $params = [
        //
    ];

    //運用此api產生的連結 選擇取貨超商
    $mapUrl = $mapGenerator
            ->withWebParams($params)
            ->mapUrl();

```

`routes/web.php:`

```
Route::post('ezship_map', 'EzshipController@handleMap');

```

`EzshipController:`

```
    use Illuminate\Http\Request;
    use Illuminate\Support\Arr;
    use Hosomikai\Ezship\EzshipMapResponse;
    ...

    public function handleMap(Request $request)
    {
        $mapResponse = new EzshipMapResponse($request->all());

        if ($mapResponse->fails()) {
            //handle fail
            return;
        }

        //成功選取的超商完整代碼
        $strCode = $mapResponse->getStoreCode()();

        //當時夾帶的 回來需要判別的使用的參數
        $yourparams = $mampResponse->getWebPara();

        //....
        // handle your flow
    }

```

新建超商取貨訂單

```
    use Ezship
    use Hosomikai\Ezship\EzshipResponse;
    ...

    $orderId = now()->format('YmdHis');                     //商店訂單編號
    $amount = 100;                                          //包裹價值金額或代收金額
    $needPay = true;                                        //是否需要代收款(取貨付款或單純取貨)
    $recipientName = 'hosomikai';                           //取貨人或收件人姓名(需與收件人證件姓名一致)
    $recipientEmail = 'service@hosomikai.com';              //取貨人或收件人信箱
    $recipientMobile = '0953539459';                        //取貨人或收件人電話
    $stCode = 'yourstcode';                                 //code you get from (EzshipMapResponse)->getStoreCode();

    $order = Ezship::newOrder($amount, $needPay, $orderId)
                ->recipient($recipientName', $recipientMobile, $recipientEmail')
                ->toStore($stCode);

    //post by redirect form
    return $order->checkout();
    ....

```

### 4. Hosomikai\\Ezship\\Contracts\\EzshipOrder

[](#4-hosomikaiezshipcontractsezshiporder)

參數值說明STORE\_NEW\_TYPE1A01超商取貨新訂單，不需在ezShip上確認訂單，可直接印單 (ezShip系統將回覆sn\_id)STORE\_NEW\_TYPE2A02超商取貨新訂單，需在ezShip上確認訂單，確認後才可進行印單 (ezShip系統預設值, 且系統將回覆sn\_id)STORE\_NEW\_TYPE3A03超商取貨新訂單，使用 輕鬆袋或迷你袋 (ezShip系統不回覆sn\_id，不需在ezShip網站上確認訂單，但需至ezShip網站後台登錄專用編號)STORE\_NEW\_TYPE4A04超商取貨新訂單，使用 輕鬆袋或迷你袋 (ezShip系統不回覆sn\_id，需在ezShip網站上確認訂單，且需至ezShip網站後台登錄專用編號)HOME\_DELIVERY\_TYPE1A05宅配新訂單 不需在ezShip上確認訂單，可直接印單 (ezShip系統將回覆sn\_id)HOME\_DELIVERY\_TYPE2A06宅配新訂單 需在ezShip上確認訂單，確認後才可進行印單 (ezShip系統將回覆sn\_id)you can set in env:

```
EZSHIP_NEW_ORDER_STATUS_STORE=
EZSHIP_NEW_ORDER_STATUS_HOME_DELIVERY=

```

or you can publish config &amp; change in `config/ezship.php:`

```
    ...

    /**
     * 建立新訂單狀態類型.
     */
    'order_status' => [
        'store' => env('EZSHIP_NEW_ORDER_STATUS_STORE', EzshipOrderStatusConstant::STORE_NEW_TYPE2),                      //超取新訂單狀態類型
        'home_delivery' => env('EZSHIP_NEW_ORDER_STATUS_HOME_DELIVERY', EzshipOrderStatusConstant::HOME_DELIVERY_TYPE2),  //宅配新訂單狀態類型
    ],

```

### 5. 查詢物流配送狀態

[](#5-查詢物流配送狀態)

```
    $snId = '3514114054';

    //this will return EzshipResponse object (by our config before)
    $order = Ezship::queryBySnId($snId);

    // return data

```

Referrece
---------

[](#referrece)

[台灣便利通/Ezship](https://www.ezship.com.tw/service_doc/service_home_w18v1.jsp?vDocNo=1702&vDefPage=04)

Change log
----------

[](#change-log)

Please see the [changelog](changelog.md) for more information on what has changed recently.

TODO
----

[](#todo)

- 查詢自動查詢物流狀態
- 觸發事件
- 紀錄ezship配送log
- 內容完善校正
- 測試
- web params exception
- 優化回傳response model

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

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

Unknown

Total

1

Last Release

1793d ago

### Community

Maintainers

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

---

Top Contributors

[![HosomiKai](https://avatars.githubusercontent.com/u/5814018?v=4)](https://github.com/HosomiKai "HosomiKai (11 commits)")

---

Tags

libraryezShip

### Embed Badge

![Health badge](/badges/hosomikai-laravel-ezship/health.svg)

```
[![Health](https://phpackages.com/badges/hosomikai-laravel-ezship/health.svg)](https://phpackages.com/packages/hosomikai-laravel-ezship)
```

###  Alternatives

[filp/whoops

php error handling for cool kids

13.2k402.4M1.4k](/packages/filp-whoops)[mockery/mockery

Mockery is a simple yet flexible PHP mock object framework

10.7k497.0M23.6k](/packages/mockery-mockery)[league/iso3166

ISO 3166-1 PHP Library

69536.3M116](/packages/league-iso3166)[dekor/php-array-table

PHP Library for printing associative arrays as text table (similar to mysql terminal console)

296.6M2](/packages/dekor-php-array-table)[ecentria/ecentria-rest-bundle

Goal of this bundle is to simplify process of creating APIs with Symfony. We use already well-coded libraries, combine them together to simplify process and not to re-invent the wheel. We've chose REST and HATEOS to have unified standards of API requests and responses.

142.4k](/packages/ecentria-ecentria-rest-bundle)

PHPackages © 2026

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