trackmage/trackmage-sdk-php
Composer 安装命令:
composer require trackmage/trackmage-sdk-php
包简介
TrackMage PHP SDK
README 文档
README
Trackmage - A tracking page for your store. Beautiful, branded, customizable.
TrackMage SDK for php
TrackMage is your most automated shipment tracking tool ever. Discover the simple way to show your customers where their parcels are, provide support and get more great reviews
Getting Started
- Create a TrackMage account – First of all, you need to sign up for a TrackMage account and retrieve your clientId and clientSecret.
- Minimum requirements – To run the SDK you need to have installed PHP >= 5.6. We highly recommend using v7.2 or higher.
- Install the SDK – Using [Composer] is the recommended way to install the
TrackMage SDK for PHP. The SDK is available on Packagist as the
trackmage/trackmage-sdk-phppackagecomposer require trackmage/trackmage-sdk-php - See the docs There are API documentation and the Swagger reference
Quick examples
Create a client
use TrackMage\Client\TrackMageClient;
$clientId = '<client-it>';
$clientSecret = '<client-secret>';
$client = new TrackMageClient($clientId, $clientSecret);
Posting a tracking number
$workspaceId = 100;
$response = $client->post('/shipments', ['json' => [
'workspace' => '/workspaces/'.$workspaceId,
'trackingNumber' => 'TN-1',
]]);
$shipment = TrackMageClient::item($response);
$response = $client->get('/workspaces/'.self::$workspaceId.'/shipments');
$shipments = TrackMageClient::collection($response);
Get workspaces list
$response = $client->get('/workspaces/'.$workspaceId.'/shipments');
$workspaces = TrackMageClient::collection($response);
Get carriers list
$response = $client->get('/public/carriers');
$carriers = TrackMageClient::collection($response);
Create webhook
Here is the webhook handler example that you need to make accessible on your side.
$workflow = [
'type' => 'webhook',
'period' => 'immediately',
'title' => 'Webhook for testing',
'workspace' => '/workspaces/<id>',
'enabled' => true,
'concurrency' => '1',
'url' => 'http://acme.example',
'authType' => 'basic',
'username' => 'webhook_user',
'password' => 'password',
'notificationEmails' => [
'test@email.com', 'test-2@email.com',
],
];
$response = $client->post('/workflows', ['json' => $workflow]);
$workflow = TrackMageClient::item($response);
$workflowId = $workflow['id'];
Tests
To run the unit tests:
composer update ./vendor/bin/phpunit
phpstan
vendor/bin/phpstan analyse -c phpstan.neon
vendor/bin/phpstan analyse -c phpstan-tests.neon
trackmage/trackmage-sdk-php 适用场景与选型建议
trackmage/trackmage-sdk-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.45k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 04 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「tracking number」 「trackmage」 「parcel tracking」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 trackmage/trackmage-sdk-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 trackmage/trackmage-sdk-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 trackmage/trackmage-sdk-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A package for working with arbitrary precision numbers in Laravel.
PHP SDK for the Parcel Monkey UK API
Gambling Algorithms for Certification.
Validates Turkish National Identification Number
Convert number (string format) between base 2 and 62
Audit changes of your Eloquent models in Laravel/Lumen
统计信息
- 总下载量: 8.45k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-20