PHPackages                             igraal/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. igraal/stats-table

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

igraal/stats-table
==================

Helper to handle stats table with multiple formatter

v1.0.0(8y ago)823.0k1MITPHPPHP ^5.6|^7.0

Since Apr 14Pushed 7y agoCompare

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

READMEChangelog (2)Dependencies (5)Versions (3)Used By (1)

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

[](#stats-table)

PHP Library to handle statistics tables and CSV, JSON and Excel exports. [![Build Status](https://camo.githubusercontent.com/fc294f19f1dbf4966762705d379484f2836989f132f049ef7bdefafc76e852d3/68747470733a2f2f7472617669732d63692e6f72672f69677261616c2f73746174732d7461626c652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/igraal/stats-table)

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 add the following require to your composer.json :

```
"require": {
    ... ,
    "igraal/stats-table": "dev-master"
}

```

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

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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 ~1079 days

Total

2

Last Release

3014d ago

Major Versions

v0.1.0 → v1.0.02018-03-29

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

v1.0.0PHP ^5.6|^7.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 (9 commits)")[![electrotiti](https://avatars.githubusercontent.com/u/5476023?v=4)](https://github.com/electrotiti "electrotiti (6 commits)")

---

Tags

phpjsonexcelxlscsvstatsstatistics

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k152.8M851](/packages/maatwebsite-excel)[avadim/fast-excel-reader

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

106693.8k9](/packages/avadim-fast-excel-reader)[jianyan74/php-excel

php excel 导入导出

5543.1k5](/packages/jianyan74-php-excel)[lekoala/spread-compat

Easily manipulate PhpSpreadsheet, OpenSpout and League CSV

1220.5k1](/packages/lekoala-spread-compat)

PHPackages © 2026

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