定制 vaened/swift-cart 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

vaened/swift-cart

最新稳定版本:v1.0.0

Composer 安装命令:

composer require vaened/swift-cart

包简介

The SwiftCart library is a powerful tool for managing shopping carts, invoicing, and product administration.

README 文档

README

Build Status Software License

This library is a powerful tool that allows you to efficiently manage purchases, quotes, accounts, and more. With this library, you can effortlessly handle various aspects of a shopping cart, including adding products, taxes, fees, and discounts, and obtaining a detailed summary of the total amount to pay.

This library is based on vaened/php-price-engine for price management

// initialize cart
$taxes = Taxes::from([
    Inclusive::proportional(18, 'IGV')
]);

$cart = new ShoppingCart($taxes);

// add products
$mouse = $cart->push(Product::findOrFail(1), quantity: 2);

// assign individual charges and discounts
$mouse->add(
    Charge::proportional(percentage: 5)->named('Delivery'),
    Charge::fixed(amount: 2)->named('Random'),
);
$mouse->apply(
    Discount::proportional(percentage: 10)->named('NewUser')
);

// update quantity
$mouse->update(quantity: 3);

// assign global charges and discounts
$cart->addAsGlobal(
    Charge::fixed(amount: 2)->named('Express')
);
$cart->applyAsGlobal(
    Discount::proportional(percentage: 1)
);

// get summary
$cart->summary();

Installation

You can install the library using composer.

composer require vaened/swift-cart

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-30