PHPackages                             paxal/stats-table - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. paxal/stats-table

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

paxal/stats-table
=================

Helper to handle stats table with multiple formatter

v2.0.6(4y ago)181.4k1[7 PRs](https://github.com/paxal/stats-table/pulls)MITPHPPHP ^7.2|^8.0CI failing

Since Apr 14Pushed 4y agoCompare

[ Source](https://github.com/paxal/stats-table)[ Packagist](https://packagist.org/packages/paxal/stats-table)[ Docs](https://github.com/paxal/stats-table)[ RSS](/packages/paxal-stats-table/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (7)Dependencies (3)Versions (10)Used By (0)

***This package is a fork of [igraal/stats-table](https://github.com/igraal/stats-table)***

stats-table
===========

[](#stats-table)

PHP Libary to handle statistics tables and CSV, JSON and Excel exports. [![Build status](https://github.com/paxal/stats-table/actions/workflows/main.yml/badge.svg)](https://github.com/paxal/stats-table/actions/workflows/main.yml)

Summary
-------

[](#summary)

This library helps you create statistical tables given some data. You provide data, headers and what you want for the footer line, and then you can dump your table into a JSON, CSV or Excel file.

This is very useful to manipulate a lot of tables you want to see in an HTML FrontOffice and when you want to add the ability to get this data in CSV or Excel File as well.

Installation
------------

[](#installation)

### Using composer

[](#using-composer)

Using composer, just run the following to require the latest stable :

```
composer req paxal/stats-table
```

Usage
-----

[](#usage)

### Using the class StatsTable

[](#using-the-class-statstable)

The class `StatsTable` is the class that will hold your data. It takes one mandotary arguments, and 4 options arguments. The simpler way to create a new table is to pass the data itself and its headers (even if headers are optional).

```
use IgraalOSL\StatsTable\StatsTable;

$data = [
    ['date' => '2014-01-01', 'hits' => 32500],
    ['date' => '2014-01-02', 'hits' => 48650],
];
$headers = ['date' => 'Date', 'hits' => 'Number of hits'];
$statsTable = new StatsTable($data, $headers);
```

### Dumping a table

[](#dumping-a-table)

Three formats are currently supported : Excel, CSV and JSON. Thus, you can use the same table with your ajax calls or to be downloaded.

First, create your dumper, then dump your data.

```
use IgraalOSL\StatsTable\Dumper\Excel\ExcelDumper;

$excelDumper = new ExcelDumper();
$excelContents = $excelDumper->dump($statsTable);

header('Content-type: application/vnd.ms-excel');
echo $excelContents
```

### Using stats table builder

[](#using-stats-table-builder)

To help you construct a table, you can use the `StatsTableBuilder` class. It helps you combine data from multiple tables, and can create automatic calculated columns. It also helps you build aggregations (aka the footer line), with multiple possibilities : ratio, sum, average or static content.

```
use IgraalOSL\StatsTable\StatsTableBuilder;

$data = [
    '2014-01-01' => ['hits' => 32500],
    '2014-01-02' => ['hits' => 48650],
];

$statsTableBuilder = new StatsTableBuilder(
    $data,
    ['hits' => 'Number of hits']
);
$statsTableBuilder->addIndexesAsColumn('date', 'Date');

$statsTable = $statsTableBuilder->build();
```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 78.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~303 days

Recently: every ~192 days

Total

9

Last Release

1658d ago

Major Versions

v0.1.0 → v1.0.02018-03-29

v1.0.0 → v2.0.02019-07-17

PHP version history (4 changes)v0.1.0PHP &gt;=5.3.3

v1.0.0PHP ^5.6|^7.0

v2.0.0PHP ^7.2

v2.0.4PHP ^7.2|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d27042e0d8f3cbedd4cd0b56a416d08c411804a20e29623aee7cf6e3ae9603f?d=identicon)[paxal](/maintainers/paxal)

---

Top Contributors

[![paxal](https://avatars.githubusercontent.com/u/1848817?v=4)](https://github.com/paxal "paxal (41 commits)")[![electrotiti](https://avatars.githubusercontent.com/u/5476023?v=4)](https://github.com/electrotiti "electrotiti (6 commits)")[![pixrr](https://avatars.githubusercontent.com/u/26383152?v=4)](https://github.com/pixrr "pixrr (5 commits)")

---

Tags

phpjsonexcelxlscsvstatsstatistics

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/paxal-stats-table/health.svg)

```
[![Health](https://phpackages.com/badges/paxal-stats-table/health.svg)](https://phpackages.com/packages/paxal-stats-table)
```

###  Alternatives

[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.2k65.5M209](/packages/openspout-openspout)[avadim/fast-excel-reader

Lightweight and very fast XLSX Excel Spreadsheet and CSV Reader in PHP

106693.8k9](/packages/avadim-fast-excel-reader)[ee/dataexporter-bundle

Easy export data to CSV, XML, HTML, JSON or XLS

4782.8k](/packages/ee-dataexporter-bundle)[lekoala/spread-compat

Easily manipulate PhpSpreadsheet, OpenSpout and League CSV

1220.5k1](/packages/lekoala-spread-compat)[jianyan74/php-excel

php excel 导入导出

5543.1k5](/packages/jianyan74-php-excel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
