afiqiqmal/parcel-track
Composer 安装命令:
composer create-project afiqiqmal/parcel-track
包简介
Api Parcel Tracking API
README 文档
README
Simple Parcel Tracker for Local Parcel Courier. Basically it just crawl the courier website or existing API. Need time to time to monitor web/api changes before failure happen.
BTW, Currently available (Successfully Scraped)
- Post Laju
- GDEX
- ABX Express
- DHL Express
- DHL E-Commerce
- SkyNet Express
- CityLink Express
- FedEx Express
- LEL Express
- KTM Distribution Sdn Bhd
- UPS
Tested in PHP 7.1 Only
Installation
Step 1: Install from composer
composer require afiqiqmal/parcel-track
Alternatively, you can specify as a dependency in your project's existing composer.json file
{
"require": {
"afiqiqmal/parcel-tracker": "^1.0"
}
}
Usage
After installing, you need to require Composer's autoloader and add your code.
require_once __DIR__ .'/../vendor/autoload.php';
Sample for Post Laju
$data = parcel_track() ->postLaju() ->setTrackingNumber("ER157080065MY") ->fetch();
Sample for GDex
$data = parcel_track() ->gdex() ->setTrackingNumber("4941410530") ->fetch();
Sample for Abx Express
$data = parcel_track() ->abxExpress() ->setTrackingNumber("EZP843055940197") ->fetch();
Sample for DHL Express
$data = parcel_track() ->dhlExpress() ->setTrackingNumber("5176011131") ->fetch();
Sample for Check Which Carrier Tracking Number belongs to
$data = parcel_track() ->setTrackingNumber("5176011131") ->checkCourier();
Method
| Method | Param | Description |
|---|---|---|
| postLaju() | Post Laju Courier | |
| abxExpress() | Post Laju Courier | |
| dhlExpress() | DHL Express Courier | |
| dhlCommerce() | DHL E-Commerce Courier | |
| gdex() | GD Express Courier | |
| skyNet() | SkyNet Express Courier | |
| cityLink() | City Link Express Courier | |
| fedEx() | FedEx Express Courier | |
| lelExpress() | Lazada E-Logistic Courier | |
| ktmDelivery() | KTM Distribution Sdn Bhd | |
| ups() | United Parcel Service Courier | |
| setTrackingNumber($refNumber) | String |
Enter the tracking number |
Result
Checking Result
For checking which carrier response like below:
{
"code": 200,
"error": false,
"possible_carrier": [
"ABX Express Sdn Bhd",
"City Link Express"
],
"generated_at": "2018-05-14 08:53:35",
"footer": {
"developer": {
"name": "Hafiq",
"homepage": "https://github.com/afiqiqmal"
}
}
}
Tracker Result
You should getting data tracker similarly like below:
{
"code": 200,
"error": false,
"tracker": {
"tracking_number": "4941410530",
"provider": "gdex",
"delivered": true,
"checkpoints": [
{
"date": "2016-11-30 17:41:10",
"timestamp": 1480527670,
"process": "Outbound from KBR station",
"type": "item_received",
"event": "Kota Bharu"
},
{
"date": "2016-11-30 17:47:00",
"timestamp": 1480528020,
"process": "Picked up by courier",
"type": "dispatch",
"event": "Kota Bharu"
},
{
"date": "2016-12-01 03:25:11",
"timestamp": 1480562711,
"process": "In transit",
"type": "facility_process",
"event": "Petaling Jaya"
},
{
"date": "2016-12-01 10:00:16",
"timestamp": 1480586416,
"process": "Inbound to JHB station",
"type": "facility_process",
"event": "Johor Bharu"
},
{
"date": "2016-12-02 10:10:00",
"timestamp": 1480673400,
"process": "Delivered",
"type": "delivered",
"event": "Sungai Tiram"
}
]
},
"generated_at": "2018-05-03 02:07:20",
"footer": {
"source": "GD Express Sdn Bhd",
"developer": {
"name": "Hafiq",
"homepage": "https://github.com/afiqiqmal"
}
}
}
Todo
- Struggling for other Parcel Data
- Keep up to date if any parcel data changes
Issue
- If Issue happen like the api always return empty [] after cross check with real site, just let me know =)
Pftt.. I just don't know why, the Travis CI is failed. It because of `gnutls_handshake() failed`. In my local env, all Test Unit Passed . I disabled it first because always failing on travis-ci.org =)
## ChangeLog - See changelog.md
License
Licensed under the MIT license
Donate
统计信息
- 总下载量: 4.11k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-05-02