KoolReport v3.0.0

New Folder Structure #

We have made a change on KoolReport's folder structure. Previously, there is repetition of koolreport folder and autoload.php if you install by composer. The repetition may cause unnecessary confusion so we decided to change. Despite of this change, everything works like before. Here is the new structure of KoolReport when you download and install:

koolreport/
├── packages/
├── src/
│   ├── clients
│   ├── core
│   ├── datasources
│   ├── processes
│   └── widgets
├── tests/
├── autoload.php

Content of folders:

  1. packages: Where extended packages will be stored
  2. src: Containing core source-code of KoolReport
  3. tests: Containing test-cases

Register Events #

For the purpose of report debugging and advanced usage, KoolReport now supports event registrations.

class MyReport extends \koolreport\KoolReport
{
    ...
    protected function OnBeforeSetup()
    {
        // Happens when report is about to call setup() method

        return true; // To allow setup() to run
    }

    protected function OnSetup()
    {
        //Happens when report has just run setup() method

    }
}

More information of events.

Improve the way to publish resources #

The function of ResourceManager class inside KoolReport is to manage report resources as well as publish those resources to public place which is accessible to browser. In this version, we have made great improvement for auto-publishing resources. Without any settings, KoolReport will smartly located public place to put assets folder to hold resources for widgets. As a result, KoolReport's widget will work whenever they are created. If in any case, you want to change the location where resources should be hold, you can do so with report's assets settings.

Introducing Theme #

Another greatest improvement in this version is the report theme supported. This is also one of the most requested feature. When a theme is applied to a report, it not only changes the css style but also change the html rendering and javascript of a widget. For example, widget working on bootstrap3 may have different html,css and javascript compare to working in bootstrap4. Due to its complication, we have postpone this feature until now. Currently we have released two basic themes which are Bootstrap3 and Bootstrap4. More themes will come in the future.

Widget Enhancements #

In this version, we have made great enhancement for Widget.

New way of loading widget #

As you may know, widgets shared common resources between each others. For example, many widgets share jQuery or moment js. So in case we have many widgets share the same resources on a report, there are repetition of loading resources. That's a waste of network resources and slow down the report rendering. Furthermore, the resource loaded by later widgets may overwrite resource of previous ones which will cause the issue for previous widgets.

In the new way of widget loading methods, we implement resource registration. This will assure resources like js or css only loaded once. This is extremely useful when your widgets is loaded via AJAX request.

Use Widget outside of KoolReport's environment #

Together with new loading methods, KoolReport's widget now does not require KoolReport's view to be rendered. You may use widget of KoolReport to rendered in any environment whether in the pure PHP or in view of PHP frameworks like Laravel, CodeIgniter.

More information, you may read about KoolReport's integration.

Accept wide range of data type as source #

Not forget to mention, we have improve the "dataSource" of widget as well. The data source of widget can receive wide range of data from other frameworks such as Collection in Laravel or unbuffered array in CodeIgniter. So basically, you can use Widget of KoolReport is other frameworks and use their native form of data to fuel the KoolReport's widget. That's awesome, isn't it?

You may have a look at how KoolReport's widget working with Laravel DB in here.

Data Manipulation with DataStore #

In this version, there is a great improvement for DataSource. Although data is processed before stored in datastore, there is the need to extract, summarize data before being visualized. And due to the fact that many widgets can shared the same DataStore used as their source of data and each widget may need only parts of data so it is easier that data can be extracted at the point of visualization. Now you may do something like this:

// Show user has income >50000
Table::create(array(
    "dataSource"=>$this->dataStore("users")->filter("income",">",50000);
));

//Show user has income <50000
Table::create(array(
    "dataSource"=>$this->dataStore("users")->filter("income","<=",50000);
));

We have added myriad of essential for DataStore. Those methods are separated into group of Selecting Methods, Aggregated Methods, Filter Methods, Sorting Methods. More details please have a look at DataStore Documentation.

Table Widget #

We understand the Table Widget is the most used widgets so we have made great enhancement for it as well.

Pagination in Bootstrap 4 #

If you are using BootStrap 4 as your theme, Table works well now. As you may know the koolphp Table built on top of Bootstrap 3, there are differences when moving to Bootstrap 4. Specifically, the old Table widget pagination could not work in Bootstrap 4. In this version we have solved this issue. Now Table's pagination can work with both Boostrap 3 and Bootstrap 4.

Remove Duplicate #

We also enhanced the feature of "removeDuplicate". As you may know the "removeDuplicate" feature will remove the value in specific columns if they are repeated. Previously we use server-side to remove the duplicate cells, however it cause extra server processing and the removeDuplicate seems not working well with pagination. Now, we have move this feature to client-side to handle. All issue has been solved, the "removeDupliate" run faster, work perfectly with pagination.

Row Group #

The great new feature of Table in this release is the Row Group. Row Group helps to sorts and organized rows of table into group and provide aggregated calculation. For example, grouping all orders by country then provide sum of order values by country. The simplest settings for RowGroup feature is:

Table::create(array(
    "dataSource"=>$this->dataStore('orders'),
    "group"=>array("country")
))

Not yet, the amazing things of Table Row Group feature is the multi-level row grouping. It means that you can have sub group inside a group. For example, you can group rows by country and in each country, there is group by city.

Table::create(array(
    "dataSource"=>$this->dataStore('orders'),
    "group"=>array("country","city")
))

For more information of RowGroup, please visit here!

Google Chart Library #

We also update the Google Chart library. Sometime Google update the library name to generate charts so we need to change according to. Recently Google has changed the library location of Gauge chart, we have updated in this version.

We also have create new ComboChart which you can create line and column chart together. The setting is very simple, please click here for more information.

We also fixed the Javascript date for Timeline chart as you may know there is difference between PHP date and Javascript date. The PHP month starts from 1 to 12 while in Javascript, month starts from 0 to 11. Because of this difference, there was a shift of month. For example, you date in server-side is Feb 1st, the Timeline will display March 1st. This problem has been solved nicely in this release. If you have this issue, please upgrade. If you don't have this issue, upgrade as well for safety.

Add charset options for CSVDataSource #

We have add the "charset" settings for CSVDataSource so that the CSVDataSource work well with different charset csv file.

Documentation & Intellisense #

If you viewed our source-code, you may see that we have documented for every classes, every properties and methods. This will be great for your immediate reference to any methods or properties to know what they are doing and how to use them.

This is also great if you use PHP IDE supporting intellisense, our documentation will be the source for IDE to display method name, description and parameters when you code.

Codeception For Testing #

Previously we use the PHPUnit to test, now we change to use CodeCeption as our tester. We decided to add another folder "tests" in framework to contain our testing cases. May be it will be useful for you if you plan to do further development base on our framework.

Bug Fixed #

Null date #

We have found some bugs related to null date in previous version. As you may know the null in date will result in error in some of processes. We have fixed those issues in DateTimeFormat, Utility format function, TimeBucket.

SubReport's Marker #

As you may know, the SubReport is another report loaded inside a main report. The sub report can be rendered directly in main report or it can be loaded via Ajax. In previous version, we use HTML comment <!-- --> to mark area to update via ajax of sub report. However later we found that in some servers, those HTML comments are removed by servers settings. So our solution is the use HTML custom tags. Now all is working well!

Timeline javascript date #

As we mention before, in previous version, Google Timeline has problem with displaying correctly date because of the difference in month's value between PHP and Javascript. This problem has been solved.

Upgrade To 3.0.0 #

Basically, everything has been kept backward compatible so you only need to replace the old library with new library. If you used any packages, please upgrade as well.

If you use DrillDown report please rename the widget to LegacyDrillDown. We have made a new DrillDown which is easier and works better. However, we still keep the old DrillDown in the new name LegacyDrillDown. Please check out our new DrillDown Example.

Summary #

KoolReport Version 3.0.0 is our big release, it is a worth version to upgrade to. There are many features added and some of them are the foundation for new capabilities to be added in the future. It remove the limitation of component's usage only within its environment to be used in anywhere. We hope that KoolReport day by day become more and more powerful yet easier to use so that data report will never be a pain.

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.