PHP code example of koolreport / instant
1. Go to this page and download the library: Download koolreport/instant 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 / instant example snippets
Widget::create(Table::class,array(
"dataSource"=>array(
array("name"=>"Peter","age"=>35),
array("name"=>"Karl","age"=>32),
)
),array(
"path"=>"../../assets"
"url"=>"/assets",
));
Widget::create(Table::class,array(
"dataSource"=>array(
array("name"=>"Peter","age"=>35),
array("name"=>"Karl","age"=>32),
)
),false);
koolreport\instant\Exporter;
Exporter::export("/full/path/to/your/file.php")
->pdf(array(
"format"=>"A4",
"orientation"=>"portrait"
))
->toBrowser("myfile.pdf");
//Index.php
querybuilder\DB;
use \koolreport\widgets\koolphp\Table;
class MyReport extends \koolreport\KoolReport
{
use \koolreport\instant\SinglePage;
use \koolreport\clients\Bootstrap;
function settings()
{
return array(
"dataSources"=>array(
"automaker"=>array(
"connectionString"=>"mysql:host=localhost;dbname=automaker",
"username"=>"root",
"password"=>"",
"charset"=>"utf8"
),
),
);
}
function setup()
{
$this->src('automaker')->query(
DB::table("customers")->select("customerNumber","customerName")
)
->pipe($this->dataStore("mydata"));
}
}
$report = new MyReport;
$report->start();