iwangr/w-provider
Composer 安装命令:
composer require iwangr/w-provider
包简介
PHP微服务商SDK
README 文档
README
提供了一个观察者以及一个基础订单生成 基础的优惠券处理 以及运费处理的观察器,对于不同业务自己可以扩展不同的观察器,以下为示例
$cart = array(
array('goods_id' => 1, 'goods_name' => '课程一', 'price' => 9.9, 'num' => 2),
array('goods_id' => 2, 'goods_name' => '课程2', 'price' => 19.9, 'num' => 1),
array('goods_id' => 3, 'goods_name' => '课程3', 'price' => 29.9, 'num' => 3),
);
$decorator = new OrderDecorator($cart);
//先处理成基础订单
$decorator->addDecorator(new BaseDecorator());
//对订单的优惠券处理
$coupon_id = 1;
$coupon_price = 20;
$coupon_where = 100;
$decorator->addDecorator(new CouponDecorator($coupon_id, $coupon_price, $coupon_where, true));
$decorator->addDecorator(new DeliveryDecorator(8, 288));
$order = $decorator->boot();
如果需要扩展或者改变为自己的处理只需要在自己的应用目录建立Decorator文件继承DecoratorInterface实现其中的方法,DecoratorInterface 需要实现以下方法
<?php
namespace cncoders\order\interfaces;
interface DecoratorInterface
{
/**
* 添加购物车数据 购物车的原始数据
* @param array $cart
* @return mixed
*/
public function addCartData(array $cart);
/**
* 添加订单数据 (上一个观察者处理的订单数据会通过这个方法传递进来
* @param array $order
* @return mixed
*/
public function addOrderData( array $order);
/**
* 返回处理结果
* @return mixed
*/
public function boot();
}
iwangr/w-provider 适用场景与选型建议
iwangr/w-provider 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 81 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 10 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ecommerce」 「wechatpay」 「微信支付」 「支付宝支付」 「电商收付通」 「TimeHelper」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 iwangr/w-provider 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 iwangr/w-provider 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 iwangr/w-provider 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Nevogate Payment Gateway SDK
Dealing with payments through the Egyptian payment gateway PayMob
A Laravel package to easily integrate Xendit payment gateway. It supports credit and debit cards, and e-wallet payments and custom invoices, queued notifications, webhook listeners and more.
微信支付在laravle5中的封装
An integrated alipay and wechat payment solution based on YouZan using php
A PHP (and Laravel) package to interface with the Snipcart api.
统计信息
- 总下载量: 81
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-10-10