Download the PHP package marcoconsiglio/faker-php-number-helpers without Composer

On this page you can find all versions of the php package marcoconsiglio/faker-php-number-helpers. 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 faker-php-number-helpers

GitHub License GitHub Release Static Badge
Static Badge Static Badge Static Badge

faker-php-number-helpers

Adds a helper trait that makes it easier to generate random numbers using FakerPHP.

Index

Installation

Use it as a production dependency

or a development dependency

Usage

Add the trait to a TestCase class if you use this library in your tests project written in PHPUnit, otherwise add it wherever you need it.

In some tests, you'll need a PHPUnit data provider, which is a static function. In this case you can call statically setUpFaker() method in order to set up a static Faker\Generator when PHPUnit call the data provider method, which is done prior to call the setUp() method.

Constants

Several constants provide the limit for random generation.

Integers

Constant Value
IntRange::MIN PHP_INT_MIN + 1
IntRange::MAX PHP_INT_MAX

Floats

Constant Value
FloatRange::MIN -PHP_FLOAT_MAX
FloatRange::MAX PHP_FLOAT_MAX
FloatRange::MICRO PHP_FLOAT_MIN
FloatRange::MAX_FRACTION 4,503,599,627,370,495.0
FloatRange::MIN_FRACTION -4,503,599,627,370,495.0

Available methods

Integer generation

Method Minimum Maximum Excluded
randomInteger() PHP_INT_MIN PHP_INT_MAX
positiveRandomInteger() 0 PHP_INT_MAX
negativeRandomInteger() PHP_INT_MIN + 1 -1 0
nonZeroRandomInteger() PHP_INT_MIN + 1 PHP_INT_MAX 0
positiveNonZeroRandomInteger() 1 PHP_INT_MAX 0
negativeNonZeroRandomInteger() PHP_INT_MIN + 1 -1 0

Float generation

Method Minimum Maximum Excluded
randomFloat() -PHP_FLOAT_MAX PHP_FLOAT_MAX
positiveRandomFloat() 0 PHP_FLOAT_MAX
negativeRandomFloat() -PHP_FLOAT_MAX 0 0
nonZeroRandomFloat() -PHP_FLOAT_MAX PHP_FLOAT_MAX 0
positiveNonZeroRandomFloat() PHP_FLOAT_MIN PHP_FLOAT_MAX 0
negativeNonZeroRandomFloat() -PHP_FLOAT_MAX -PHP_FLOAT_MIN 0
randomFraction() FloatRange::MIN_FRACTION FloatRange::MAX_FRACTION integer floats
positiveRandomFraction() PHP_FLOAT_MIN FloatRange::MAX_FRACTION integer floats
negativeRandomFraction() FloatRange::MIN_FRACTION -PHP_FLOAT_MIN integer floats

Next float number

Some times you need to have the previous/next representable float adjacent to a specific number.

To solve this problem you can use the NextFloat class, which is a convenient wrapper of the nsfisis/php-next-after library.

API Documentation

See more in the API Documentation at ./docs/html/index.html.


All versions of faker-php-number-helpers with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
fakerphp/faker Version ^1.24
nsfisis/next-after Version ^1.1
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 marcoconsiglio/faker-php-number-helpers contains the following files

Loading the files please wait ...