Skip to content
A Fully Featured Statistical Library for PHP
PHP Other
  1. PHP 99.3%
  2. Other 0.7%
Branch: master
Clone or download
Pull request Compare This branch is 207 commits ahead of robzienert:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

PHPStats Statistical Library

Introduction to PHPStats PHPStats is a statistical library for PHP. Its goal is to implement statistical functions in PHP that are not covered in the PHP core. PHPStats is written entirely in native PHP for ease of installation and for use in shared hosting environments, where the installation of binary files is difficult, if not impossible.

Downloading PHPStats To download PHPStats visit the GitHub page for the latest code or download the current stable version.

Installation Installing PHPStats is easy. Just copy the PHPStats.phar file into the folder where you keep your libraries and include the file in your scripts. At this point, you can just start using the classes directly; the classes will autoload when needed. As an example: include('PHPStats.phar');

To use a class, remember to properly call the namespace that it's in. For example, to create a new instance of the Beta distribution, call it like this: $beta = new \PHPStats\ProbabilityDistribution\Beta(6,20);

If performance is a concern, files can be pre-emptively loaded, rather than waiting for the autoload functionality. For example, to pre-load the Beta class file, call: include('phar://PHPStats.phar/lib/ProbabilityDistribution/Beta.php');

Dependencies PHPStats is written to work with PHP 5.3 and greater, as it makes heavy use of features introduced in PHP 5.3. No other run-time dependencies exist.

Build dependencies include both Phing and PHPUnit. When attempting to build this library, beware that the tests for the random variate functions are probabalistic in nature and will fail on occasion.

License PHPStats is released under the LGPL version 3 or later. For more details, please refer to the copy of LICENSE.txt that accompanies your download.

Change Log


Added Levy distribution

Added Kmeans clustering

Matrix constructor now optionally takes arrays


Added LogNormal distribution

Tested and fixed all random number generators

Added Kolmogorov-Smirnov test

Completed implementing the gamma family of special functions

Many bugfixes


Added a Matrix class for Linear Algebra

Added the Rayleigh Distribution


Added the Cauchy Distribution

Assorted bug fixes


First release of PHPStats

You can’t perform that action at this time.