Download the PHP package koolreport/twig without Composer
On this page you can find all versions of the php package koolreport/twig. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download koolreport/twig
More information about koolreport/twig
Files in koolreport/twig
Package twig
Short Description Allow KoolReport to use twig template engine to render view
License MIT
Homepage https://www.koolreport.com
Informations about the package twig
Twig
Overview
Starting from version 4.0.0, KoolReport supports other template engines rather than just its own template view file. Twig
is one of the popular template engines that KoolReport supports.
Installation
By downloading .zip file
- Download
- Unzip the zip file
- Copy the folder
twig
intokoolreport
folder so that look like below
By composer
Get started
Step 1: Add the twig service to your report
Step 2: Create the view report.html
inside views
folder like below:
Step 3: You can run your report with following line of code
Congrat, Now you can use Twig to design your report.
Some notes:
- In your template, you refer to report object with parameter
report
- When use function
widget()
to generate koolreport's widget, you should change the backslash\
in the class name to dot"."
, for example, you change:\koolreport\widgets\koolphp\Table
tokoolreport.widgets.koolphp.Table
- You can reference to any datastore with
report.dataStore("name_of_datastore")
Limitation
There are some limitation due to the fact that Twig
does not allow PHP to run within. This limits some of capability of KoolReport's widget such as defining anonymous function. For example, there is no way to define custom function to format value in Table widget like this.
Simply it is not able to transform above php code to json definition in twig.
Resources
Support
Please use our forum if you need support, by this way other people can benefit as well. If the support request need privacy, you may send email to us at [email protected].