

GitHub - vgpastor/DiscountsCalculator: Helper library for calculating discounts...
source link: https://github.com/vgpastor/DiscountsCalculator
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

DiscountsCalculator
Helper library for calculating discounts in a application.
Installation
This library are developed to PHP 8.1, use Enum so it's not possible using in previously versions, if you like you can put a PR to make compatible with previous versions..
composer install vgpastor/discounts-calculator
Usage
Yo can see how to use in example.php file.
Required parameter are
- $type: Type of discount. Can be 'percentage' or 'amount' and based in base amount or in total amount (see DiscountTypeEnum)
- $base (float) - Base price
- $discount (float) - Discount percentage or amount
Optional parameters are
- $tax (float) - Tax percentage By default is 0%
- $precision (int) - Precision of the result. By default is 2
- $roundingMode (int) - Rounding mode. By default is PHP_ROUND_HALF_UP
Recommend
-
51
An easy PHP Library for calculating national holidays
-
30
Like many of my blog posts, this post is inspired by some work I was doing with a customer who had a requirement to calculate quartiles of a ranked set of d...
-
29
HyperLEDA is a service which provides a database and collection of tools to study the physics of galaxies and cosmology. The project began in 1983 and is currently maint...
-
28
README.md
-
28
Interacting with APIs usually requires a lot of networking code. You can solve this problem by abstracting all of that and calling Swift functions to get the results. In this tutorial you’ll learn how to create an API help...
-
44
The easy PHP Library for calculating holidays Keep your <global> application in sync with holiday dates - Forever
-
5
Download library source and cookbook examples - 12.7 KB
-
3
What's new in the Twilio helper library for ASP.NET (v6.0.0 - August 2022)
-
7
Introducing Twilio's Go Helper Library
-
5
vgpastor/discounts-calculator...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK