PHPstats: Modern Statistical Computing in PHP
A family of PHP packages for statistical work, so that web applications can run analyses without leaving PHP.
I develop and maintain PHPstats, a family of PHP packages for statistical work.
The PHP ecosystem, especially Laravel, is an excellent way to build full stack web applications, but struggles with statistical computing, often requiring interfacing with APIs or making system calls to R or Python. I built these packages so that PHP web applications can run statistical analyses without leaving PHP.
The packages are heavily influenced by the tidyverse in R. I used AI to help build them. The correctness of all outputs is validated against pre-existing, trusted libraries.
The PHPstats library currently includes:
phit: a PHP extension written in Rust for common statistical distribution models, with phit-polyfill, a pure-PHP version for systems without the extension
phibble and phpolars: tibble-style data frames, including a wrapper for Polars
phplyr: influenced by dplyr, tidyr, and janitor for PHP, a package for manipulating phibble data frames
phiz: an implementation of much of the ggplot2 interface, rendered with Vega-Lite
cmdstanphp: a PHP port of CmdStanR
juphyter: a Jupyter and Quarto kernel for PHP
The source code is on GitHub.