KoolReport and Yii2
Overview #
KoolReport works great with Yii2 Framework like any other PHP MVC Framework.
Guide #
We have created Yii2-Example Repository to demonstrate our tutorial.
Step 1: Install KoolReport #
composer require koolreport/core
Step 2: Create reports folder #
Create reports
folder in the root folder to hold reports. You may find our MyReport
sample report within reports
folder. The MyReport contains class file MyReport.php
and view file MyReport.view.php
Step 3: Create action inside controller: #
...
public function actionReport()
{
$report = new \app\reports\MyReport;
$report->run();
return $this->render('report',array(
"report"=>$report
));
}
In the action of Yii2, we create report object, run it and then pass the report object to the view.
You may find the report.php
view with following content:
<?php $report->render();?>
Step 3: Call the action from browser: #
http://localhost/yii2-example/web/index.php?r=site%2report
Result #
Happy Reporting!
Get started with KoolReport
KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.