PHPackages                             nicolastavella/phpreport - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nicolastavella/phpreport

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nicolastavella/phpreport
========================

Library for generating reports from PHP

01211PHP

Since Oct 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/nicolastavella/phpreport)[ Packagist](https://packagist.org/packages/nicolastavella/phpreport)[ RSS](/packages/nicolastavella-phpreport/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

PHPReport
=========

[](#phpreport)

PHPReport is a class for building and exporting reports from PHP. It's based on powerful [PHPExcel](http://www.phpexcel.net/) library and includes exporting to popular formats such are HTML, Excel or PDF.

Features
--------

[](#features)

- Simple for using
- Many ways to customize your input data
- Build reports based on predefined templates
- Export to HTML, Excel (xlsx and xls) and PDF

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

[](#installation)

Install [composer](https://getcomposer.org), and run `composer update` to install the required `PHPExcel` dependencies

Usage and examples
------------------

[](#usage-and-examples)

Basicly, there are two way to build a report.

### Building it "from scratch"

[](#building-it-from-scratch)

PHPReport does all the work, your just provide it with your data, like this:

```
$R=new PHPReport();
$R->load(array(
            'id'=>'product',
            'data'=>array(
                        array('Some product',23.99),
                        array('Other product',5.25),
                        array('Third product',0.20)
                )
            )
        );

$R->render();
```

It's great for exporting tabular data. Input data can be further formatted, grouped and customized. See the wiki.

### Building it from template

[](#building-it-from-template)

Template is usually some excel file, already formatted and with placeholders for data. There are two types of placeholders: static and dynamic. Static placeholders are, for example, some data like date, city or customer name. Dynamic placeholders are, for example, list of products with variable number of rows.

```
$R=new PHPReport(array('template'=>'invoice_template.xls'));
$R->load(array(
		array(
				'id'=>'invoice',
				'data'=>array(
					'date'=>date('Y-m-d'),
					'number'=>'000312',
					'customer_id'=>'512',
					'expiration_date'=>date('Y-m-d',strtotime('+30day')),
					'name'=>'John Doe',
					'company'=>'Example, inc',
					'address'=>'Some address',
					'city'=>'Gotham City',
					'zip'=>'0123',
					'phone'=>'+123456'
				),
				'format'=>array(
					'date'=>array('datetime'=>'d/m/Y'),
					'expiration_date'=>array('datetime'=>'d/m/Y')
				)
			),
		array(
				'id'=>'product',
				'data'=>array(
					array('description'=>'Some product','price'=>23.99,'total'=>23.99),
					array('description'=>'Other product','price'=>5.25,'total'=>2.25)
				),
				'repeat'=>true,
				'format'=>array(
					'price'=>array('number'=>array('prefix'=>'$','decimals'=>2)),
					'total'=>array('number'=>array('prefix'=>'$','decimals'=>2))
				)
			)
		)
	);

$R->render();
```

These reports are great for complex exports like invoices. See the wiki for more examples.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7e670716c8c1e9d85328c55f972554dcec49c5c3e9f7ce22b3fd081f21349b00?d=identicon)[nicolastavella](/maintainers/nicolastavella)

---

Top Contributors

[![nicolastavella](https://avatars.githubusercontent.com/u/6143117?v=4)](https://github.com/nicolastavella "nicolastavella (14 commits)")[![vernes](https://avatars.githubusercontent.com/u/973728?v=4)](https://github.com/vernes "vernes (14 commits)")[![jmb-oliveira](https://avatars.githubusercontent.com/u/7149283?v=4)](https://github.com/jmb-oliveira "jmb-oliveira (1 commits)")[![tonythomas01](https://avatars.githubusercontent.com/u/4214481?v=4)](https://github.com/tonythomas01 "tonythomas01 (1 commits)")

### Embed Badge

![Health badge](/badges/nicolastavella-phpreport/health.svg)

```
[![Health](https://phpackages.com/badges/nicolastavella-phpreport/health.svg)](https://phpackages.com/packages/nicolastavella-phpreport)
```

PHPackages © 2026

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