Report's assets

Overview #

As you may know, the report's view contains widgets which are the component to display your data. Widgets can be Table, charts, graphs or any form of data representation.

Widget after receiving data will render html together with its resources such as Javascript files and CSS.

So in order to make widget works, its resources has to be loaded to browser or in other words, resources of widget need to be put in a public place where they can be accessed.

If koolreport folder is placed in public place then widget's resources can be accessed directly. There is no doubt about it. However, in many cases due to security or other reasons, koolreport folder is put in inaccessible place, for example vendor folder.

The solution to overcome is to copy resources of widgets to a public folder where they could be accessed.

So, in the settings() method of your report, you may set the path to the assets folder which KoolReport should copy resources to and tell KoolReport the url which resources will be accessed.

class MyReport extends \koolreport\KoolReport
    protected function settings()
        return array(

So in above example, we would like to publish the widgets resources to assets folder which located 2 levels above the folder of report. And the assets folder can be accessed with url

Auto-publish resources #

If you don't set any settings, KoolReport will try its best to locate a public place where it can put resources. If KoolReport see that koolreport library is put in public place then it will generate direct link to resources inside library. In another case which koolreport is inaccessible by browser, KoolReport will locate a place and copy resources automatically.

Packages for PHP Frameworks #

Nowadays, it is very high chance that you will use a php framework like Laravel, CodeIgniter, Symfony etc. to build your application. In order to facilitate the usage of KoolReport inside those frameworks, we develop Koolreport's packages for each frameworks so that your report can works seamlessly inside those. Setting the assets folder for KoolReport automatically is a task of those packages.

Please have a look at our free packages for Laravel, CodeIgniter and Yii2. More packages for other frameworks will come in near future!

Get started with KoolReport

KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.