Download the PHP package switchsystems/precision-maths without Composer

On this page you can find all versions of the php package switchsystems/precision-maths. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package precision-maths

Precision Maths

This module provides various classes for performing precision mathematics using BC MATH internally

See http://php.net/manual/en/book.bc.php for more information on the BC Math Extension

Licence

This library is copyright 2014, 2015 Switch Systems Ltd and is licenced under the Mozilla Public License 2.0.

Number Class

The precision number class provides all the basic math operations provides by the BC Math extension

Numbers are immutable and will always return a new object with the value of the operation.

Example:

$number = new Number('20'); // Instatiates Number object with a value of 20
$result = $number->add('20'); // returns a new instance of Number with a value of 40
echo $result; // prints '40' 

Number Collection Class

The number collection can be instatiated with an array as the first argument. It has various methods for performing basic math operations on the set

Example:

$numberCollection = new NumberCollection(['1', '2', '3']);
$mean = $numberCollection->mean(); // returns a new instance of number set to the value of the mean of the set
echo $mean; // prints '2'

Tax Utility

This utility class can be instatiated to perform basic tax operations. It takes tax rate as the first argument of the constructor

Methods:

fetchValueOfTaxToBeAdded

Returns the value of tax that would be added:

$vatUtil = new TaxUtility('20');
$vat = $vatUtil->fetchValueOfTaxToBeAdded('125'); // Returns instance of number set to '25'
echo $vat // prints '25'

fetchValueOfAddedTax

Returns the value of tax that would be added:

$vatUtil = new TaxUtility('20');
$vat = $vatUtil->fetchValueOfAddedTax('150'); // Returns instance of number set to '25'
echo $vat // prints '25'

addTaxTo

Returns the value of tax that would be added:

$vatUtil = new TaxUtility('20');
$priceWithVat = $vatUtil->addTaxTo('125'); // Returns instance of number set to '150'
echo $priceWithVat // prints '150'

removeTaxFrom

Returns the value of tax that would be added:

$vatUtil = new TaxUtility('20');
$priceWithVatRemoved = $vatUtil->removeTaxFrom('150'); // Returns instance of number set to '125'
echo $priceWithVatRemoved // prints '125'

Finance Utility

Currently only provides one method:

calculatePayForPeriod

$financeUtil = new FinanceUtility();
$pay = $financeUtil->calculatePayForPeriod($startDateTimeObject, $endDateTimeObject, '6.50', '30');

Decimal DateTime Utility

This class has a variety of methods for calculating time in a specified unit for a date range and various convertion methods


All versions of precision-maths with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package switchsystems/precision-maths contains the following files

Loading the files please wait ...