koolphp / koolreport

This is an Open Source PHP Reporting Framework which you can use to write perfect data reports or to construct awesome dashboards using PHP
https://www.koolreport.com/
MIT License
226 stars 66 forks source link

How to use KoolReport in CakePHP #6

Open jholthusen opened 6 years ago

jholthusen commented 6 years ago

I am trying to integrate koolreport into Cake PHP 3 . COuld you please share a short tutorial on the correct approach and how to distribute the different components between Controller and View in Cake? Thanks!

koolphp commented 6 years ago

Hi,

The same with other MVC frameworks, The way to setup KoolReport is simple.

  1. Save the "koolreport" folder into "vendors" folder of Cake
  2. In the "app" folder, you can create a folder name "reports" to hold all reports created with KoolReport
  3. Create a SaleReport.php and SaleReport.view.php inside "reports" folder.
  4. In SaleReport.php, please require correct path to "koolreport/autoload.php"
  5. On top of your controller, for example PageController.php, you put require with correct path to SaleReport.php for example require "../reports/SaleReport.php"
  6. Inside the controller action, you can start create report object:
$report = new SaleReport;
$report->run();
$this->set("report",$report);
  1. In the view of the controller, you can render the report:
<div>
<?php $report->render(); ?>
</div>

Hope that helps.