PHP code example of koolreport / codeigniter

1. Go to this page and download the library: Download koolreport/codeigniter 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 / codeigniter example snippets


class MyReport extends \koolreport\KoolReport
{
    use \koolreport\codeigniter\Friendship;

    function settings()
    {
        return array(
            "dataSources"=>array(
                "csv_source"=>array(
                    "class"=>'\koolreport\datasources\CSVDataSource',
                    'filePath'=>dirname(__FILE__)."\mycsvdata.csv",
                )
            )
        );        
    }

    function setup()
    {
        //Now you can access database that you configured in codeigniter
        $this->src("sale_database")
        ->query("select * from orders")
        ->pipe($this->dataStore("orders"));

        $this->src("csv_source")
        ->pipe(...)
        ...
        ->pipe($this->dataStore("csv"));
    }
}

class MyReport extends \koolreport\KoolReport
{
    use \koolreport\codeigniter\Friendship;

    function settings()
    {
        return array(
            "assets"=>array(
                "url"=>"myassets",
                "path"=>"../myassets" // or "path"=>"/var/html/CIProject/myassets"
            )
        );        
    }