1. Go to this page and download the library: Download koolreport/core library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
koolreport / core example snippets
// index.php: Just a bootstrap file
$salesByCustomer->run()->render();
ecify some data processes that will be used to process
use \koolreport\processes\Group;
use \koolreport\processes\Sort;
use \koolreport\processes\Limit;
//Define the class
class SalesByCustomer extends \koolreport\KoolReport
{
protected function settings()
{
//Define the "sales" data source which is the orders.csv
return array(
"dataSources"=>array(
"sales"=>array(
"class"=>'\koolreport\datasources\CSVDataSource',
"filePath"=>"orders.csv",
),
)
);
}
protected function setup()
{
//Select the data source then pipe data through various process
//until it reach the end which is the dataStore named "sales_by_customer".
$this->src('sales')
->pipe(new Group(array(
"by"=>"customerName",
"sum"=>"dollar_sales"
)))
->pipe(new Sort(array(
"dollar_sales"=>"desc"
)))
->pipe(new Limit(array(10)))
->pipe($this->dataStore('sales_by_customer'));
}
}
use \koolreport\widgets\koolphp\Table;
use \koolreport\widgets\google\BarChart;