Download the PHP package robier/probability-checker without Composer

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

codecov


ProbabilityChecker

Pretty simple probability implementation that can be used for A/B testing. If you have some feature that you want to run on 20% of the requests. This is right tool for you as you do not need to define how many requests there will be in total.

If you provide 0 as a parameter, it will always return false, if you provide 100, it will always return true. Everything in between will be around the number you provided.

Note: This method is not exact but approximation, so if you want 20%, you will get 21%, 23% maybe 18%, but at the end it will be around 20% (the greater number of request, more accurate will be the percentage).

Installation

This library can be installed via composer:

Sample usage

1st run

2nd run

3rd run

From this you can see that the percentage is not exact, but it is around 30% as we defined.

Methods

We have few methods in the class:

Name Description
roll() Like rolling the dice, depending on provided percentage it will be true or false
isCertian() If percentage is 100 or more, this method will return true
isImpossible() If percentage is 0 or less, this method will return true
isPossible() If percentage is between 0 and 100 (both excluded), this method will return true
::always() Factory method, that will create new instance with 100%
::never() Factory method, that will create new instance with 0%

Local development

To run tests locally you can use provided docker setup. Just run:

to build the image and then run:

to run the tests. If you want to run tests with coverage, you can run:


All versions of probability-checker with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 robier/probability-checker contains the following files

Loading the files please wait ....