quellabs/canvas-shipments 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

quellabs/canvas-shipments

最新稳定版本:1.0.1

Composer 安装命令:

composer require quellabs/canvas-shipments

包简介

Shipment router for the Canvas PHP framework. Discovers and routes shipment operations to installed provider packages.

README 文档

README

Shipment router for the Canvas framework. Discovers installed shipping provider packages automatically via composer metadata and routes shipment operations to the correct provider.

Installation

composer require quellabs/canvas-shipments

How it works

ShipmentRouter scans installed packages for composer metadata declaring a provider class under the shipments discovery key. Any package that declares one and implements ShipmentProviderInterface is registered automatically — no manual configuration required.

The provider class must implement a static getMetadata() method returning a modules array. Each entry becomes a routable module identifier.

"extra": {
"discover": {
"canvas": {
"controller": "Quellabs\\Shipments\\SendCloud\\SendCloudController"
},
"shipments": {
"provider": "Quellabs\\Shipments\\SendCloud\\Driver",
"config": "config/sendcloud.php"
}
}
}

At runtime, ShipmentRouter uses the shippingModule field on the request to route calls to the correct provider.

Usage

Inject ShipmentRouter via Canvas DI:

use Quellabs\Shipments\ShipmentRouter;
use Quellabs\Shipments\Contracts\ShipmentRequest;
use Quellabs\Shipments\Contracts\ShipmentAddress;
use Quellabs\Shipments\Contracts\CancelRequest;

class FulfillmentService {
    public function __construct(private ShipmentRouter $router) {}

    public function ship(): ShipmentResult {
        return $this->router->create(new ShipmentRequest(
            shippingModule:  'sendcloud_postnl',
            reference:       'order-12345',
            deliveryAddress: new ShipmentAddress(
                name:              'Jan de Vries',
                street:            'Keizersgracht',
                houseNumber:       '123',
                houseNumberSuffix: null,
                postalCode:        '1015 CJ',
                city:              'Amsterdam',
                country:           'NL',
                email:             'jan@example.com',
            ),
            weightGrams: 1200,
            methodId:    8,
        ));
    }
}

Available methods

Method Description
create(ShipmentRequest) Create a parcel, returns tracking code and label URL
cancel(CancelRequest) Cancel a parcel before carrier pickup
exchange(string $driver, string $parcelId) Fetch current shipment state (call to reconcile missed webhooks)
getShippingOptions(string $module) Fetch available shipping methods for a module
getRegisteredModules() Returns all discovered module identifiers

Requirements

  • PHP 8.2+
  • Quellabs Canvas framework

License

MIT

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固