About PHPstats
PHPstats is a set of open-source PHP packages for data analysis: data frames, data transformation, statistical models, Bayesian inference, charts, and notebooks. Each package can be installed and used on its own. They are designed to work well together.
PHPstats was created by Erik Westlund.
Packages
| Package | Purpose |
|---|---|
| phibble | Immutable, typed data frames for PHP. |
| phplyr | dplyr, tidyr, and janitor data wrangling in PHP. |
| phpolars | Polars data frames for PHP through a native extension. |
| juphyter | A Jupyter and Quarto kernel for PHP. |
| phit | Statistical models, probability distributions, and descriptive statistics. |
| phiz | ggplot2-style charts rendered with Vega-Lite. |
| CmdStanPHP | Bayesian modeling with Stan from PHP, through CmdStan. |
Design
PHPstats is heavily influenced by the tidyverse and the tidy approach to statistical computing in R. It also draws on ideas and software from the Python community, including Polars and Jupyter, as well as from the Stan ecosystem.
- phibble: data frames modeled on tibble, file reading modeled on readr, and the factor functions of forcats.
- phplyr: the data manipulation features of dplyr, tidyr, and janitor.
- phpolars: the Polars library, wrapped in a PHP extension. Its API follows Polars' Python library.
- juphyter: a PHP kernel for Jupyter, modeled on IRkernel, that also runs PHP in Quarto documents.
- phit: its own Rust implementation of regression, mixed models, and distributions, drawing on R's stats, lme4, and statsmodels. Models are written in R's formula syntax.
- phiz: the grammar of graphics of ggplot2.
- CmdStanPHP: a PHP interface to CmdStan, with an API modeled on CmdStanR.
Validation
The packages include comparisons against established R and Python libraries. Each package documents its checks:
- phibble verification
- phplyr verification
- phpolars verification
- juphyter verification
- phit verification
- phiz verification
- CmdStanPHP verification
AI statement
PHPstats was developed with AI assistance. Large language models wrote and revised much of the code and documentation. Rebuilding the methods of established R, Python, and Stan packages in PHP by hand would not be practical for one person.
Credit for those methods belongs to the authors of the original packages, which each package's documentation names and links. Each package's results are compared against those packages, and the Verification section of each package publishes the comparisons. If you find an error, please open an issue in the package's repository in the PHPstats organization on GitHub.
Source and license
The source of every package and of this site is in the PHPstats organization on GitHub. The site and every package except CmdStanPHP are released under the MIT license. CmdStanPHP is released under the GNU General Public License, version 3 or later, because parts of it follow GPL-licensed R packages. Each repository's THIRD_PARTY_NOTICES.md lists the code that follows other projects, with their licenses.