KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

How to use KoolReport in Yii framework? #34

Open KoolReport opened this topic on on Jul 20, 2017 - 7 comments

KoolReport commented on Jul 20, 2017

KoolReport can work with any PHP Framework in the market: CodeIgniter, Laravel, CakePHP, etc. You name it we have example for it. We design KoolReport to be flexible and can be a part of bigger system. We want KoolReport to do one thing and do it well. That is to provide great report/dashboard.

Yii is one of our favorite frameworks beside Laravel and CodeIgniter. We use Yii to code many project including this website. So today I would like to give some basic guide to integrate KoolReport into Yii Framework.

Steps:

  1. Download KoolReport and unzip
  2. Create extension folder in Yii protected folder to hold the library
  3. Copy the koolreport folder into extension folder
  4. Create folder reports to store your report.
  5. Create two files MyReport.php and MyReport.view.php in reports folder
  6. In MyReport, you need to required koolreport library like this require_once dirname(__FILE__)."/../extension/koolreport/autoload.php". The rest of setup report is the same.
  7. In any Yii controller that you want to use MyReport, you do require_once dirname(__FILE__)."/../reports/MyReport.php"
  8. In controller action, you can create MyReport as easy as $report = new MyReport;

Now your report can be run and rendered. If you want you can run and render your report inside controller action. If not, you can pass the $report variable to the view of Yii. I recommend this way since we can utilize the layouts features of Yii framework.

To pass report variable to view, you do:

$this->render('myview',array(
    "report"=>$report,
));

To run and render report in the view (myview.php), you do:

...
<?php $report->run()->render(); ?>
...

Hope that helps.

Fredy Yair Suarez Diaz commented on Jun 22, 2018

Favor explicar más detallado, por ejemplo: reportes/examples/reports/basic/sakila_rental/ en yii framework

(Please explain more detail, for example: reportes/examples/reports/basic/sakila_rental/ in yii framework)

KoolReport commented on Jun 23, 2018

Above instruction guides you how to call/load an report created with KoolReport inside Yii. In the same manner, you can add the SakilaRental report into Yii like above guide.

Fredy Yair Suarez Diaz commented on Jun 26, 2018

Perdone mi ignorancia!

Fredy Yair Suarez Diaz commented on Jun 26, 2018

Gracias por la orientación, Dios te bendiga y me ilumine

anhardeni commented on Nov 12, 2019

is this, in yii1 ?? , is there any complete example on yii2

KoolReport commented on Nov 13, 2019

The integration with Yii2 is even easier than Yii1, we just need to install koolreport with composer and all will be autoloaded, we will make tutorial for it.

KoolReport commented on Jan 16, 2020

If you are looking for integrating KoolReport into Yii2, follow this guide

https://github.com/koolreport/yii2-example

Thank you very much!

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
wiki

None