Open dawoodjee opened 9 years ago
Providing this as is, I do not have real any experience with cakephp, but I have done this similarly with codeigniter and the joomla framework.
Copy php-reports to the vendor directory.
In your controller use this to import the php-reports
public function construct() { parent::construct(); require_once(ROOT . 'vendor' . DS . 'php-reports' . DS . 'vendor' . DS . 'autoload.php'); require_once(ROOT . 'vendor' . DS . 'php-reports' . DS . 'lib' . DS . 'PhpReports' . DS . 'PhpReports.php');
}
Then you can take whats in the methods that you see in the index.php in php-reports and wrap them with your controller methods.
Like this below
// list reports public function index(){ PhpReports::listReports(); }
public function report($format) {
if(isset($format)) {
PhpReports::displayReport($_REQUEST['report'],$format);
}
else {
PhpReports::displayReport($_REQUEST['report'],'html');
}
}
This should be enough to get you started in the right direction.
I did the same steps but this message was displayed Cannot find config file because the pathes in the PhprReports.php are relative
You may need to edit the PhpReports.php file.
you'll have to make a few changes to some of the reference paths.
That should be it to get it to work.
@adam-je I'm looking for something similar for a cakephp 3 app. Were you able to integrate this reporting plugin with cakephp? If not what was your solution?
Appreciate any advice you can share.
Hi,
I've been looking for a PHP Reporting Framework to use in my CakePHP 3.x Application. Is there a quick guide for integration out there or could you please give me quick tips to get me started off as i'm hacking away at your docs and my code.?
CakePHP requires that third-party code be placed in app_name/vendors directory, which is what your this framework also does. I see that php-reports also does some URL rewriting, and other things that CakePHP already handles and this has me concerned about compatibility.
Any and all help on this will be greatly appreciated. Thanks