merinsky/balikobot
Composer 安装命令:
composer require merinsky/balikobot
包简介
Balikobot API
README 文档
README
Balikobot API
It offers implementation of Balikobot API described in the documentation, ver.1.79.
Installation
composer require merinsky/balikobot
Usage
To order shipment you should done these steps:
- add packages to the front
- order packages collection (for each shipper)
use Merinsky\Balikobot\Balikobot; define('API_USER', '...'); define('API_KEY', '...'); define('SHOP', 100); // create instance of the class $balikobot = new Balikobot(API_USER, API_KEY, SHOP); // add package $package = $balikobot->service(Balikobot::SHIPPER_PPL, 4, [ Balikobot::OPTION_ORDER => '2017000001', ]) ->customer('Jan Novak', 'Jankovcova 2', 'Praha', '17000', '+420773145254', 'jan.novak@email.cz') ->add(); /* dump($package); [ carrier_id => 40458564564, package_id => 7338, label_url => http://pdf.balikobot.cz/ppl/eNorpelvMdA1trS0NAJcMA_plao., status => 200, ] */ // order packages collection $response = $balikobot->order(Balikobot::SHIPPER_PPL, [$package['package_id'], ...]); /* dump($response); [ order_id => 788, handover_url => http://pdf.balikobot.cz/ppl/eNrpelMTIyMaA1r6elNANcMA_xAn4., labels_url => http://pdf.balikobot.cz/ppl/eNrpelIyMdAgfrSrpelVcMA_wAn0., status => 200, ] */
Use the getServices method to get available services for a given shipper. It returns associative array, serviceId => description. Use the serviceId as a service method parameter.
$response = $balikobot->getServices(Balikobot::SHIPPER_PPL); /* dump($response); [ 2 => PPL Parcel Connect, 3 => PPL Parcel CZ Dopolední balík, 4 => PPL Parcel CZ Private, 8 => PPL Parcel CZ Business, 9 => PPL Parcel CZ Private - Večerní doručení, 15 => PPL Firemní paleta, 19 => PPL Soukromá paleta, ] */
Use the getOptions method to get available options for a given shipper. It returns list of options.
$response = $balikobot->getOptions(Balikobot::SHIPPER_DPD); /* dump($response); [ 0 => price, 1 => real_order_id, 2 => sms_notification, 3 => branch_id, 4 => del_insurance, 5 => note, 6 => weight, ] */
The getBranches method is useful for pickup services. You can get list of pickup places (branches). This method is available only for some services.
$response = $balikobot->getBranches(Balikobot::SHIPPER_CP, 'NP'); /* dump($response); [ 67152 => [ name => Hluboké Mašůvky, city => Hluboké Mašůvky, street => 230, zip => 67152, country => CZ, type => branch ], 74282 => [ ] ... ] */
Use the getZipCodes method to get available zip codes for given shipper and service. This method is not available for pickup services, of course.
$response = $balikobot->getZipCodes(Balikobot::SHIPPER_ULOZENKA, 2); /* dump($response); [ 0 => 97401, 1 => 97405, 2 => 97411, ... ] */
You can create labels only for given packages by calling getLabels method.
$response = $balikobot->getLabels(Balikobot::SHIPPER_PPL, [1258, 544, 5454, ...]); /* dump($response); http://pdf.balikobot.cz/ppl/eNsrMadfMdA1trS0NffcMA_vAnw. */
Call overview method to get list of packages in the front (added by add method).
$response = $balikobot->overview(Balikobot::SHIPPER_PPL); /* dump($response); [ 0 => [ eshop_id => 20170000071490299455, carrier_id => 13805004931509, package_id => 5732, label_url => http://pdf.balikobot.cz/dpd/eNfaMTIyMdAtwrt1BFwzDWECQA.., ], ... ] */
Call trackPackage method to get list of tracking information.
$response = $balikobot->trackPackage(Balikobot::SHIPPER_PPL, '40425465434'); /* dump($response); [ 0 => 01.07.2014 11:11 1383 Hradec Kralove - Pouchov (CZ) 6211385 doručeno : BALIKOBOT CZ •50311 • 1383 351 327, 1 => 01.07.2014 06:37 1383 Hradec Kralove - Pouchov (CZ)rozvoz CZ •50311 • 1383 351 327, 2 => 01.07.2014 06:32 1383 Hradec Kralove - Pouchov (CZ)příjem na depo CZ •50311 • 1383 64 327, 3 => 30.06.2014 16:56 1381 Ricany (CZ)vyzvednutí CZ •50311 • 1383 686 327, ] */
Call trackPackageLast method to get status id and message of the last tracking information. It is useful to summarize status of several packages.
$response = $balikobot->trackPackageLast(Balikobot::SHIPPER_PPL, '40425465434'); /* dump($response); [ status_id => 2, status_text => Zásilka je doručována příjemci., ] */
The methods you use very rarely:
- getCountryCodes()
- getCurrencies()
- getCountriesForService($shipper)
- getOptionServices()
- getManipulationUnits($shipper)
- dropPackage($shipper, $packageId)
merinsky/balikobot 适用场景与选型建议
merinsky/balikobot 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.09k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2017 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「delivery service」 「Balikobot」 「Shipper」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 merinsky/balikobot 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 merinsky/balikobot 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 merinsky/balikobot 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP SDK for the Parcel Monkey UK API
A fast and intuitive dependency injection container.
A PSR-7 compatible library for making CRUD API endpoints
Registry service.
Serve Laravel Assets from a Content Delivery Network (CDN)
swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations
统计信息
- 总下载量: 3.09k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2017-03-23