Download the PHP package hstanleycrow/easyphpreports without Composer

On this page you can find all versions of the php package hstanleycrow/easyphpreports. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package easyphpreports

EasyPHPReports

PHP library to generate Excel, CSV and PDF reports (plus ready-to-embed HTML) from plain tabular data. It is a thin, opinionated layer on top of PhpSpreadsheet and mPDF: you describe the columns once and hand over an array of rows, and the library takes care of headers, number/date formatting, column sizing and summary totals.

Features

Requirements

Installation

Quick start

The library only needs two things: a columns definition and an array of rows. Each row is an associative array whose values are read in order — the keys are up to you, but the value order must match the columns definition.

The sample data above is hardcoded for illustration only. In a real application the rows would come from a database, an API, or any other source. The library does not depend on any specific data source.

Generating downloadable files

For EXCEL, CSV and PDF you must pass a file path (without extension — it is added automatically). Make sure the target directory exists and is writable.

Swap PHPReport::EXCEL for PHPReport::CSV or PHPReport::PDF to get the other formats — everything else stays the same.

Column definition

Each entry in the columns array is an associative array with three keys:

Key Type Description
header string Column title shown in the first row.
format string One of the CellFormat constants (see below).
calculate bool When true, adds a summary row at the bottom for that column.

CellFormat constants

Constant Cell format Summary (calculate: true) Expected input value
CellFormat::TEXT General text COUNTIF (non-empty count) any string
CellFormat::NUMBER Integer number SUM numeric
CellFormat::DECIMAL Decimal, thousands SUM numeric
CellFormat::MONEY USD currency ($) SUM numeric
CellFormat::DATE DD/MM/YYYY COUNTIF string in Y-m-d format
CellFormat::DATETIME DD/MM/YYYY HH:MM:SS COUNTIF string in Y-m-d H:i:s format

An invalid DATE/DATETIME value throws InvalidArgumentException.

Public API

Member Signature Description
PHPReport::initialize() static initialize(): void Registers the four built-in report types. Call once before generating.
new PHPReport(...) __construct(string $type, array $columns, array $rows, ?string $filepath = null) Creates a report of the given type.
PHPReport::generate() generate(): string Builds the report. Returns the HTML table (SCREEN) or the saved file path.
PHPReport::isDownloadable() isDownloadable(): bool false for SCREEN, true for EXCEL/CSV/PDF.
PHPReport::registerType() static registerType(string $type, string $className): void Registers a custom report type (advanced/extension use).

Report types

Constant Output filepath generate() returns isDownloadable()
PHPReport::SCREEN HTML <table> ignored HTML string false
PHPReport::EXCEL .xlsx file required file path true
PHPReport::CSV .csv file required file path true
PHPReport::PDF .pdf file required file path true

Notes and limitations

License

MIT © Harold Rivas (Harold Crow)


All versions of easyphpreports with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
phpoffice/phpspreadsheet Version ^5.0
mpdf/mpdf Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hstanleycrow/easyphpreports contains the following files

Loading the files please wait ...