PHP Report: Generate Excel, HTML, PDF reports from data arrays

Recommend this page to a friend!

Picture of verni
Name: verni <contact>
Classes: 1 package by
Country: Bosnia and Herzegovina Bosnia and Herzegovina
Age: 35
All time rank: 3552 in Bosnia and Herzegovina Bosnia and Herzegovina
Week rank: 136 2 in Bosnia and Herzegovina Bosnia and Herzegovina

  Detailed description   Download .zip .tar.gz   Install with Composer  
This class can generate reports in Excel, HTML and PDF formats from arrays of data.

It takes arrays of data that define the contents and format of cells of a spreadsheet and it generates an spreadsheet file using the PHPExcel package in several formats like Excel, HTML and PDF.

The class allows defining the content and format of header and footer cells, alignment and width for different groups of cells, define groups of cells, etc..



PHPReport is a class for building and exporting reports from PHP. It's based on powerful PHPExcel library and includes exporting to popular formats such are HTML, Excel or PDF.


  • 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


Install composer, and run composer update to install the required PHPExcel dependencies

Usage and examples

Basicly, there are two way to build a report.

Building it "from scratch"

PHPReport does all the work, your just provide it with your data, like this: <pre> $R=new PHPReport(); $R->load(array(

                    array('Some product',23.99),
                    array('Other product',5.25),
                    array('Third product',0.20)

$R->render(); </pre>

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

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.

<pre> $R=new PHPReport(array('template'=>'invoice_template.xls')); $R->load(array(

				'name'=>'John Doe',
				'company'=>'Example, inc',
				'address'=>'Some address',
				'city'=>'Gotham City',
				array('description'=>'Some product','price'=>23.99,'total'=>23.99),
				array('description'=>'Other product','price'=>5.25,'total'=>2.25)

$R->render(); </pre>

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

  Classes of verni  >  PHP Report  >  Download .zip .tar.gz  >  Support forum (14)  >  Blog  >  Latest changes  
Name: PHP Report
Base name: php-report
Description: Generate Excel, HTML, PDF reports from data arrays
Version: 1.5
PHP version: 5.2
License: GNU Lesser General Public License (LGPL)
All time users: 7502 users
All time rank: 246
Week users: 2 users
Week rank: 124
  Groups   Screenshots   User ratings  
  Applications   Related pages   Files  

PHP 5 Classes using PHP 5 specific features View top rated classes
Files and Folders Listing, accessing and manipulating files and folders View top rated classes

File Role Description
phpreport_example.png Screen Simple generation of report from excel template

  User ratings  
RatingsUtility Consistency Documentation Examples Tests Videos Overall Rank
All time: Good (97%) Good (91%) Sufficient (72%) Good (86%) - - Sufficient (73%) 199
Month: Not yet rated by the users

  Applications that use this package  
No pages of applications that use this class were specified.

If you know an application of this package, send a message to the author to add a link here.

  Related pages  
PHPReport @ GitHub
Latest version and examples

File Role Description
examples (10 files) Doc. Documentation
Advanced_examples.txt Doc. Some examples with templates
Examples.txt Doc. Some examples
composer.json Data Auxiliary data
PHPReport.php Class Class source

  Files  /  examples  
File Role Description
   example_1.php Example Example script
   example_10.php Example Example script
   example_2.php Example Example script
   example_3.php Example Example script
   example_4.php Example Example script
   example_5.php Example Example script
   example_6.php Example Example script
   example_7.php Example Example script
   example_8.php Example Example script
   example_9.php Example Example script

Install with Composer - Download all files: php-report.tar.gz
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.

For more information send a message to info at phpclasses dot org.