Download the PHP package madbyad/mpl-number-converter without Composer

On this page you can find all versions of the php package madbyad/mpl-number-converter. 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 mpl-number-converter

MPL Number Converter

The MPL (MadByAd PHP Library) Number Converter is a simple PHP library which is used for number conversion and others such as converting a number to a roman numeral e.g 12 to XII, abbreviating a number e.g 25.690 to 25.6K, formatting a number e.g 1000000 to 1.000.000 and other number manipulation function.

Installation

to install the package go ahead and open composer then write the command

Abbreviating Number

To abbreviate or deabbreviate number you can use the numberToAbbreviate or abbreviateToNumber method.

The numberToAbbreviate(int $number, int $precision = 1, array $symbolSet = null) method is used for shortening long integer, it takes 3 parameter, first is the integer to convert, second is to determine the precision (how many digit behind decimal point) and the last is the symbol set which is the symbol to use when the number is higher than a certain digit. To define a custom symbolSet the parameter must be an associative array where the key represent the digit count and the value corresponds to the symbol to use.

Example 1

output

Example 2

output

The abbreviateToNumber(string $abbreviatedNumber, array $symbolSet = null) method is used for deabreviating abbreviated number (converting an abbreviated int to a normal int), it takes 2 parameter, first is the abbreviated number and the second is the symbol set which is the symbol to use when the number is higher than a certain digit. To define a custom symbolSet the parameter must be an associative array where the key represent the digit count and the value corresponds to the symbol to use.

Example 1

output

Example 2

output

Formating Number

To format or unformat a number you can use the numberToFormat and formatToNumber method

The numberToFormat(int $integer, string $separatorStyle = ".") method is used for formatting number (so it can be easily read especially for long digit number), it takes 2 parameter, first is the integer number and second is the separator style which determine what kind of separator you want to use, by default its . but you change it to anything except a-z A-Z 0-9 and it must be a 1 character long string

Example

output

The formatToNumber(string $formattedInt) method is used for unformatting a number (converting a formatted integer which is in a form of string into a normal integer), it takes only 1 parameter and that is the formatted integer string

Example

output

Alphabet Conversion

To convert a number to an alphabet or the opposite, you can use the numberToAlphabet and the alphabetToNumber method

The numberToAlphabet(int $number, bool $uppercase = true) method is used for converting a number to an alphabet (usefull for making alphabetically ordered list), it takes only 2 parameter, first is the integer and the second is to determine whether should the letter be uppercase or lowercase.

Example

output

The alphabetToNumber(string $alphabet) method is used for converting an alphabet string into its integer value, it only takes 1 parameter and that is the alphabet string

Example

output

Binary Conversion

To convert a number to a binary and the opposite, you can use the numberToBinary and binaryToNumber method

The numberToBinary(int $number) method is used for converting an integer to a binary string, it takes 1 parameter and that is the number

Example

output

The binaryToNumber(string $binary) method is used for converting a binary string to an integer, it takes 1 parameter and that is the binary string

Example

output

Hexadecimal Conversion

To convert a number to a hexadecimal string and the opposite, you can use the numberToHexadecimal and hexadecimalToNumber method

The numberToHexadecimal(int $number, bool $uppercase = true) method is used for converting a number to a hexadecimal string, it takes 2 parameter, first is the integer number, and the second is to determine whether the letter on the hexadecimal string should be uppercased or lowercased

Example

output

The hexadecimalToNumber(string $hexadecimal) method is used for converting a hexadecimal string to an integer, it takes only 1 parameter and that is the hexadecimal string

Example

output

Octal Conversion

To convert a number to an octal or the opposite, you can use the numberToOctal and octalToNumber method

The numberToOctal(int $number) method is used for converting a number to an octal, it takes only 1 parameter and that is the integer number

Example

output

The octalToNumber(string $octal) method is used for converting an octal string to a number, it takes only 1 parameter and that is the octal string

Example

output

Roman Conversion

To convert a number to a roman numeral or the opposite, you can use the numberToRoman and romanToNumber method

The numberToRoman(int $number) method is used for converting a number to a roman numeral (usefull for making list ordered with roman numeral), it takes only 1 parameter and that is the integer number

Example

output

The romanToNumber(string $roman) method is used for converting a roman numeral to a number, it takes only 1 parameter and that is the roman numeral

Example

output


All versions of mpl-number-converter with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.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 madbyad/mpl-number-converter contains the following files

Loading the files please wait ....