quellabs/canvas-payments
Composer 安装命令:
composer require quellabs/canvas-payments
包简介
Payment router for the Canvas PHP framework. Discovers and routes payment operations to installed provider packages.
README 文档
README
Payment router for the Canvas framework. Discovers installed payment provider packages automatically via composer metadata and routes payment operations to the correct provider.
Installation
composer require quellabs/canvas-payments
How it works
PaymentRouter scans installed packages for composer metadata declaring a provider class under the payments discovery key. Any package that declares one and implements PaymentProviderInterface 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\\Payments\\Mollie\\MollieController" }, "payments": { "provider": "Quellabs\\Payments\\Mollie\\Driver", "config": "config/mollie.php" } } }
At runtime, PaymentRouter uses the paymentModule field on the request to route calls to the correct provider.
Configuration
After composer install, the package publishes a default config file to config/mollie.php via a post-autoload-dump script. Edit this file to set your API key, webhook URL, redirect URL, and cancel URL.
Usage
Inject PaymentRouter via Canvas DI:
use Quellabs\Payments\PaymentRouter; use Quellabs\Payments\Contracts\PaymentRequest; use Quellabs\Payments\Contracts\RefundRequest; class CheckoutService { public function __construct(private PaymentRouter $router) {} public function pay(): string { $response = $this->router->initiate(new PaymentRequest( paymentModule: 'mollie_ideal', amount: 999, // in minor units — €9.99 currency: 'EUR', description: 'Order #12345', )); if (!$response->success) { throw new \RuntimeException($response->errorMessage); } return $response->redirectUrl; } }
Available methods
| Method | Description |
|---|---|
initiate(PaymentRequest) |
Start a payment session, returns redirect URL and transaction ID |
refund(RefundRequest) |
Issue a refund for a completed payment |
exchange(string $transactionId) |
Fetch current payment state (call from webhook handler) |
getRefunds(string $transactionId) |
Returns all refunds for a given transaction |
getPaymentOptions(string $module) |
Fetch available issuers or options for a payment module |
getRegisteredModules() |
Returns all discovered module identifiers |
Requirements
- PHP 8.2+
- Quellabs Canvas framework
License
MIT
quellabs/canvas-payments 适用场景与选型建议
quellabs/canvas-payments 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「router」 「payments」 「canvas」 「discovery」 「canvas-payments」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 quellabs/canvas-payments 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 quellabs/canvas-payments 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 quellabs/canvas-payments 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dealing with payments through the Egyptian payment gateway PayMob
Librería para la gestión sencilla de pagos mediante TPV Redsys y Paypal
Router
PMVC App Action Router
Database alias router extension for Nette Framework
Visual marketing automation with node-based canvas for Sylius 2.x
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-17