Download the PHP package 021/numeric without Composer

On this page you can find all versions of the php package 021/numeric. 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 numeric

021/numeric

A PHP library to convenient work with arbitrary precision numbers.

Tests Total Downloads Latest Stable Version License

Requirements

Library is based on Brick\Math package:

Although the library can work seamlessly on any PHP installation, it is highly recommended that you install the GMP or BCMath extension to speed up calculations. The fastest available calculator implementation will be automatically selected at runtime.

Installation

You can install the package via composer:

Usage

Calculations

All computational functions accept as an argument a value of one of the following types: string, float, int, \O21\Numeric\Numeric, \Brick\Math\BigNumber.

Function Description
add Adds a value to a number
sub Subtracts a value from a number
mul Multiplies a number by a value
div Divides a number by a value

Comparisons

All comparison functions accept as an argument a value of one of the following types: string, float, int, \O21\Numeric\Numeric, \Brick\Math\BigNumber.

Function Description
equals Checks if two values are equal. It returns true if the values are equal and false otherwise.
greaterThan Compares two values and returns true if the first value is greater than the second one.
lessThan Compares two values and returns true if the first value is less than the second one.
greaterThanOrEqual Compares two values and returns true if the first value is greater than or equal to the second one.
lessThanOrEqual Compares two values and returns true if the first value is less than or equal to the second one.

Formatting

Function Description
positive Returns a number represented as positive.
negative Returns a number represented as negative.
scale Converts a number to a given scale, using rounding if necessary.
get Returns a number as string. By default removes trailing zeros. Use the raw: true option to disable this.
__toString Returns a get function result

Helpers

Namespace: O21\Numeric\Helpers

Function Description
num Creates a new Numeric instance
num_min Returns a minimum value from a given values. Support any of these types: string, float, int, \O21\Numeric\Numeric, \Brick\Math\BigNumber
num_max Returns a maximum value from a given values. Support any of these types: string, float, int, \O21\Numeric\Numeric, \Brick\Math\BigNumber
to_bn Converts any of these types string, float, int, \O21\Numeric\Numeric, \Brick\Math\BigNumber to \Brick\Math\BigNumber

All versions of numeric with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3
brick/math Version ^0.11
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 021/numeric contains the following files

Loading the files please wait ....