Open koolphp opened 7 years ago
Question, why do you need to copy koolreport to codeigniter/application/libraries? Isn't composer and vendor supported?
Yes, KoolReport support installing through composer, if you installed through composer you do not need to copy files or require the "autoload.php" of KoolReport
We have create CodeIgniter package to make KoolReport work seamlessly inside CodeIgniter. While KoolReport is working well with CodeIgniter from the beginning, however there are two issues that most people asked:
So this new package will help you to do above things with a simple line of code:
class MyReport extends \koolreport\KoolReport
{
use \koolreport\codeigniter\Friendship;// All you need to do is to claim this friendship
function setup()
{
//Now you can access database that you configured in codeigniter
$this->src("sale_database")
->query("select * from orders")
->pipe($this->dataStore("orders"));
}
}
Simple, isn't it?
The package is TOTALLY FREE so you can just download it. FYI, we also create the same package for Laravel as well. We plan to add more packages like this for other PHP Frameworks like Symfony, CakePHP, Yii2 etc.
Hope that helps.
Regards
Hi @koolphp I have installed using composer both KoolReport and CodeIgniter packages. I created the reports folder in the application and used friendship but CodeIgniter is not finding the kool report class. `<?php class MyReport extends \koolreport\KoolReport { use \koolreport\codeigniter\Friendship;// All you need to do is to claim this friendship //use \koolreport\clients\Bootstrap;
function setup()
{
//Now you can access database that you configured in codeigniter
$this->src("recursoshumanos")
->query("select * from licenciaporempleado")
->pipe($this->dataStore("licencias"));
}
}?>`
Please replace the bellow path in MyReport.php file, it will work.
require APPPATH."/libraries/koolreport/autoload.php";
(old)
require APPPATH."libraries\koolreport\core\autoload.php";
(replace with this one).
thanks.
Below are basic steps to integrate KoolReport into CodeIgniter:
require APPPATH."/reports/MyReport.php";
class Welcome extends CI_Controller {
}
<?php //MyReport.php require APPPATH."/libraries/koolreport/autoload.php"; class MyReport extends \koolreport\KoolReport { use \koolreport\clients\Bootstrap; function settings() { return array( "assets"=>array( "path"=>"../../assets", "url"=>"assets", ), "dataSources"=>array( "automaker"=>array( "connectionString"=>"mysql:host=localhost;dbname=automaker", "username"=>"root", "password"=>"", "charset"=>"utf8" ) ) ); } function setup() { $this->src('automaker') ->query("Select * from offices") ->pipe($this->dataStore("offices")); } }
<?php //MyReport.view.php use \koolreport\widgets\koolphp\Table; ?>
MyReport
List all offices
$this->dataStore("offices"), "class"=>array( "table"=>"table table-hover" ) )); ?>