Generate professional print-ready DOCX, DOC, RTF, PDF reports in PHP easily with Aspose Reporting Engine. Generate documents and reports based on templates, automate your document-processing systems with PHP SDK.
Introduction
It is believed that an application is only as good as the data we can get out of it, that`s why Report Generation has become an essential part of modern software design. In general terms Report Generation is a process that takes required data from some informational environment and exports it to standard document formats such as DOCX, DOC, RTF or PDF. Report generation consists of making a document template with a special placeholder tags that, in the final document, are replaced by data from external data sources.
Reporting Engine
Cloud Reporting Engine is a subset of
Aspose Words REST API
that allows PHP developers to generate reports with an extended set of reporting features. It acts as the middleware between the data layer and the application layer. The most powerful feature of the Reporting Engine is the
LINQ-scripting
, used to bind placeholder tags in the report template to the external JSON, XML or CSV data sources and perform data sorting, filtering and grouping on the fly. This approach makes the template syntax plain, flexible and effective.
Since Report Generation is a logged-in service, you need to have an
Client Id
and
Client Secret
identifiers to authenticate before being able to use the Aspose Cloud API.
Automate your document-processing systems with PHP SDK
Aspose provides the best document-processing capabilities with constantly emerging
Cloud SDK family
, targeting mainstream programming languages, and allows developers to:
Generate DOCX, DOC, PDF reports in a fast, clear and reliable way.
Automate the report generation process and standardize the results with a consistent style that looks appealing and cool.
Design data visualizations to deliver the best analytical behavior to the end-user and meet his personalized needs.
Using our PHP SDK you can easily integrate with Cloud Reporting Engine API and generate highly customized reports. Richly formatted documents like packing slips, inventories, invoices, shipment reports can be constructed on the fly as a part of your application.
Report Generation Input and Output
The
inputs
to the Report Generation process are:
The underlying data. A good report generation practice requires data, that is exact, timely, appropriate for the effective supervision and decisions at hand.
The report template, containing static content (text, images, logos, etc.) and special tags with composing LINQ-expressions, that regulate the report generation.
The
output
can be rendered in a variety of document formats: DOCX, DOC, PDF, RTF, HTML, MHTML, TXT and many others.
Generate Your Report with PHP in 3 Steps
Prepare your source data in JSON, XML or CSV formats.
Create a report template.
Write a simple PHP application to bind the data to the template and produce the output document.
Preparing a Source Data
Prepare your data by extracting and transforming your business objects and other data sources to JSON, XML and CSV. Since data is often fragmented and distributed in a variety of formats, creating the appropriate information processing subsystem may be required.
Creating a Template
Create a template, containing static content and special tags with
composing LINQ-expressions
.
A good Report design should reflect the end-user`s view and the types of questions the user will ask. The type of the data content is the first reason to decide what type of report template you may use. For many decision-makers, diagrams and charts can provide additional insight into certain tendencies that may not be obvious from tabular reports. Therefore, tabular data and graphics can be combined in a single report with the relative weighting determined by end-user preferences and analytical requirements.
Writing a simple PHP code to generate a report
Writing a PHP code is the final step: Cloud Reporting Engine will interpret and apply the composing LINQ-expressions, merging template and data.
How to generate a report in PHP
Install
PHP SDK library
via composer.
Go to the
Aspose Cloud Dashboard
.
Create
a new Account
to access all applications and services or Sign In to your account.
Click on
Applications
in the left menu to get
Client Id
and
Client Secret
.
Check out the
Developer Guide
to working with Reports in PHP.
Check out our
GitHub repository
for a complete API list along with working examples.
Check out the
API Reference page
for the description of APIs parameters.
"products": [
{ "name": "Monitor", "price": 2, "quantity": 2},
{ "name": "Computer", "price": 3, "quantity": 1}
"date": "2015-03-15",
"products": [
{ "name": "Monitor", "price": 2, "quantity": 1},
{ "name": "Printer", "price": 1, "quantity": 2},
{ "name": "Computer", "price": 3, "quantity": 1}
use Aspose\Words\WordsApi;
use Aspose\Words\Model\Requests;
use Aspose\Words\Model\ReportEngineSettings;
$appSid = "####-####-####-####-####";
$appKey = "##################";
$wordsApi = new WordsApi($appSid, $appKey);
$data = file_get_contents("data.json");
$settings = new ReportEngineSettings(array("data_source_type" => "Json"));
$request = new Requests\BuildReportOnlineRequest("template.docx", $data, $settings);
$result = $wordsApi->buildReportOnline($request);
rename($result->getPathname(), "result.docx");