Download the PHP package simplito/bigint-wrapper-php without Composer

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

BigInteger wrapper library for PHP

Information

This library is a common interface for php_gmp and php_bcmath modules. It automatically detects supported modules and uses the best of them (gmp>bcmath). Gmp is a lot faster, but is also missing on many hosting services -- that is why this wrapper has been created. It is used for example in encryption functions of the PrivMX WebMail software.

Installation

You can install this library via Composer:

Documentation

If you want to force using a specific implementation, then define constant S_MATH_BIGINTEGER_MODE - set it to "gmp" or "bcmath". If you do not do this, mode of operation and the constant will be set automatically.

If there are no gmp and bcmath modules, an exception will be thrown. If you want to prevent this, then simply define S_MATH_BIGINTEGER_QUIET constant.

All functions of this library are implemented as members of class BigInteger, which is located under BI namespace. Instances of BigInteger are immutable - member functions usually return new instances of the BigInteger class.

ConvertibleToBi - a placeholder type

To make the below documentation more readable we use the "ConvertibleToBi" type symbol, which in reality can be one of the following types:

If you have a non-decimal string and want to use it -- first you have to convert it to BigInteger class using:

BI\BigInteger class members

construct(ConvertibleToBi $value = 0, int $base = 10)

Creates a new instance of BigInteger. If you pass an invalid value, an exception will be thrown. If $base === true then passed $value will be used without any check and conversion. Supported bases: 2, 10, 16, 256.

static BigInteger|false createSafe(ConvertibleToBi $value = 0, int $base = 10)

Creates a new BigInteger instance in the same way as constructor, but if there is an error, false will be returned instead of throwing an exception.

BigInteger add(ConvertibleToBi $x)

Adds numbers

BigInteger sub(ConvertibleToBi $x)

Subtracts numbers

BigInteger mul(ConvertibleToBi $x)

Multiplies numbers

BigInteger div(ConvertibleToBi $x)

Divides numbers

BigInteger divR(ConvertibleToBi $x)

Returns a remainder of the division of numbers. The remainder has the sign of the divided number.

array(BigInteger, BigInteger) divQR(ConvertibleToBi $x)

Divides numbers and returns quotient and remainder. Returns an array(), with the first element being quotient, and the second being remainder.

BigInteger mod(ConvertibleToBi $x)

The "division modulo" operation. The result is always non-negative, the sign of divider is ignored.

BigInteger gcd(ConvertibleToBi $x)

Calculates greatest common divisor

BigInteger|false modInverse(ConvertibleToBi $x)

Inverses by modulo, returns false if inversion does not exist.

BigInteger pow(ConvertibleToBi $x)

The power function.

BigInteger powMod(ConvertibleToBi $x, ConvertibleToBi $n)

The modular power function.

BigInteger abs()

Returns absolute value.

BigInteger neg()

Negates the number

BigInteger binaryAnd(ConvertibleToBi $x)

Bitwise AND.

BigInteger binaryOr(ConvertibleToBi $x)

Bitwise OR

BigInteger binaryXor(ConvertibleToBi $x)

Bitwise XOR

BigInteger setbit($index, $bitOn = true)

Sets bit at given index

bool testbit($index)

Tests if a bit at given index is set

int scan0($start)

Scans for 0, and returns index of first found bit

int scan1($start)

Scans for 1, and returns index of first found bit

int cmp(ConvertibleToBi $x)

Compares numbers, returns <0, 0, >0

bool equals(ConvertibleToBi $x)

Checks if numbers are equal

int sign()

Sign of number, returns -1, 0, 1

int toNumber()

Converts to number (use only with small 32/64bit numbers)

string toDec()

Converts to decimal string

string toHex()

Converts to hex string

string toBytes

Converts to binary string

string toBits()

Converts to bits string (0 and 1 characters)

string toString(int $base = 10)

Converts to string using given base (supported bases 2-62, 256)


All versions of bigint-wrapper-php with dependencies

PHP Build Version
Package Version
No informations.
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 simplito/bigint-wrapper-php contains the following files

Loading the files please wait ....