shubo/module-shipping-shippo
Composer 安装命令:
composer require shubo/module-shipping-shippo
包简介
Shippo carrier adapter for Shubo_ShippingCore — first real carrier integration proving the carrier-agnostic abstraction (rate quote, label purchase, webhook, polling).
README 文档
README
First real carrier adapter for Shubo_ShippingCore. Integrates Shippo as a multi-carrier aggregator — one API key gives access to USPS, UPS, FedEx, DHL, and dozens of regional carriers.
Apache 2.0 · Magento 2.4.8 · PHP ≥ 8.1.
What it does
- Rate quote — POST
/shipments→ returns all eligible rates, filtered by your allowed-carriers config. - Label purchase — POST
/transactions→ picks cheapest (or the operator's preferred carrier) and persists the Shippo transaction id for idempotent retries. - Tracking — webhook handler for
track_updatedevents + poller fallback via GET/tracks/{carrier}/{tracking}. - Cancel — POST
/refundsto void a purchased label. - Signature verification — HMAC-SHA256 with
hash_equalstiming-safe compare; empty signatures rejected.
What it does NOT do
- COD (Shippo supports it only on USPS, not relevant for international shipments from Georgia).
- Georgia-domestic delivery (use a domestic carrier adapter — Wolt Drive or Trackings.ge when those adapters land).
listCities()/listPudos()— both return[]. Shippo does not expose a city or PUDO API.
Install
composer require shubo/module-shipping-shippo bin/magento module:enable Shubo_ShippingShippo bin/magento setup:upgrade bin/magento cache:flush
For local development on this module inside a duka container, bind-mount the standalone repo. See /home/nika/duka/docker-compose.override.yml for the pattern.
Configure
Set the API key + webhook secret via CLI. Test keys start with shippo_test_* and cannot purchase real labels — the project's spending-safety floor.
bin/magento config:set shubo_shipping_shippo/api/mode test bin/magento config:set shubo_shipping_shippo/api/enabled 1 bin/magento config:set shubo_shipping_shippo/api/key "shippo_test_xxxxxxxxxxxx" bin/magento config:set shubo_shipping_shippo/api/webhook_secret "$(openssl rand -hex 32)" bin/magento cache:flush config
For live rollout, save the shippo_live_* key through the admin UI (Stores → Configuration → Sales → Shippo Carrier) so the Encrypted backend model encrypts it at rest. Live mode hard-fails if it reads a plaintext value from core_config_data.
Register the webhook
curl -X POST -H "Authorization: ShippoToken $SHIPPO_KEY" \ -H "Content-Type: application/json" \ -d '{"url":"https://<your-host>/rest/V1/shubo-shipping/webhook/shippo","event":"track_updated","is_test":true}' \ https://api.goshippo.com/webhooks/
The webhook URL is owned by Shubo_ShippingCore's WebhookReceiver — this module only registers the handler inside the core dispatcher.
Smoke test (live sandbox)
bin/magento shipping_shippo:smoke-rate \ --from-country=US --from-state=CA --from-city="San Francisco" --from-zip=94107 \ --to-country=US --to-state=NY --to-city="New York" --to-zip=10001 \ --weight-kg=0.5
Expected output (sandbox):
Provider Method Price ETA Rationale
--------------------------------------------------------------------------------
USPS USPS_usps_ground_advantage 8.83 5d shippo-rate-<id>
UPS UPS_ups_ground_saver 9.18 5d shippo-rate-<id>
...
Status enum map (Shippo → ShippingCore normalized)
| Shippo | ShippingCore | Terminal |
|---|---|---|
UNKNOWN |
pending |
no |
PRE_TRANSIT |
awaiting_pickup |
no |
TRANSIT |
in_transit |
no |
DELIVERED |
delivered |
yes |
RETURNED |
returned |
yes |
FAILURE |
failed |
yes |
Development
composer install vendor/bin/phpunit vendor/bin/phpstan analyse vendor/bin/phpcs
Tests mock CurlFactory — no live Shippo calls from PHPUnit. Live verification goes through the smoke CLI only.
Cost note
Shippo charges ~$0.05 per purchased label on top of the carrier's posted rate. This lands in the buyer/merchant's shipping cost, not Shubo's margin.
Design doc
docs/design.md — ~200 lines, authoritative spec for the 10 core flows + failure handling + idempotency + security.
shubo/module-shipping-shippo 适用场景与选型建议
shubo/module-shipping-shippo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 139 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「shipping」 「marketplace」 「logistics」 「shippo」 「magento2」 「carrier」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 shubo/module-shipping-shippo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shubo/module-shipping-shippo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 shubo/module-shipping-shippo 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Miaoxing Logistics Plugin
PHP SDK for the Parcel Monkey UK API
PHP wrapper for DPD Germany SOAP API
Metamel Addresses is a polymorphic Laravel package, for address book management. You can add addresses to any eloquent model with ease.
Automatically translate and review your content via Lokalise.
Unofficial PHP SDK for Poste Delivery Business Rest API services
统计信息
- 总下载量: 139
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 48
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2026-04-30