1. Go to this page and download the library: Download darkorsa/shop library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
darkorsa / shop example snippets
php
use Plane\Shop\Discount\TotalPriceThresholdDiscount;
$priceTresholdDiscount = new TotalPriceThresholdDiscount('Discount description', $cart, [
'treshold' => 100,
'discount' => 0.1 // ten percent discount for total gross price above 100
]);
$cart->addDiscount($priceTresholdDiscount);
php
use Plane\Shop\CartPresenter;
$cartPresenter = new CartPresenter($cart);
echo $cartPresenter->totalNet(); // 10.00
echo $cartPresenter->totalGross(); // 10.22
echo $cartPresenter->tax(); // 0.22
php
use Money\Currencies\ISOCurrencies;
use Money\Formatter\IntlMoneyFormatter;
$numberFormatter = new \NumberFormatter('us_US', \NumberFormatter::CURRENCY);
$moneyFormatter = new IntlMoneyFormatter($numberFormatter, new ISOCurrencies());
$cartPresenter = new CartPresenter($cart, $moneyFormatter);
echo $cartPresenter->totalNet(); // $10.00
echo $cartPresenter->totalGross(); // $10.22
echo $cartPresenter->tax(); // $0.22
php
$cartData = $cartPresenter->toArray();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.