项目作者: mkakpabla

项目描述 :
Shoppingcart library in php use session
高级语言: PHP
项目地址: git://github.com/mkakpabla/shoppingcart.git
创建时间: 2019-10-18T10:07:45Z
项目社区:https://github.com/mkakpabla/shoppingcart

开源协议:

下载


Build Status

Shopping Cart

Requirements

  • PHP 7.2 or higher
  • Composer for installation

Quick Start

Installation

  1. composer require "mkakpabla/shoppingcart"

Usage

  1. <?php
  2. require 'vendor/autoload.php';
  3. $cart = new Cart();
  4. $cart->addItem(1, [
  5. 'name' => 'item1',
  6. 'price' => 'item2'
  7. ], 2);
  8. // Return the list of the CartItems
  9. $items = $cart->getItems();
  10. // Return the price of the cart
  11. $cartPrice = $items->totalPrice()