The KoolReport Blog

Announcements, discussions, and more for KoolReport and its extended packages.

How to create charts using PHP and MySQL database

As a budding developer, you may find yourself grappling with the intricacies of visualizing data from databases like MySQL in captivating charts and graphs. Fear not, for I am here to guide you through the process with the help of KoolReport—a powerful PHP framework that will revolutionize your data visualization journey and simplify your development workflow.

Traditionally, achieving data visualization involved a series of complex steps. You would need to harness the power of PHP to query your database, transform the retrieved data into the specific format required by the chosen charting library, export it as JSON, and then write client-side JavaScript code to render the charts. This process not only consumed a significant amount of time but also presented challenges when switching between different charting libraries.


  1. AnyChart: Connecting MySQL Database to JS Chart Using PHP
  2. FusionChart: Create Interactive Charts using PHP and MySQL Database
  3. Learning Programming: Google Chart with PHP and MySQL

But behold! KoolReport is about to unveil a new world of data visualization simplicity. Developed with a laser focus on data reporting, this framework will enable you to effortlessly create visually stunning charts directly from your database, eliminating the need for tedious and error-prone transformation processes. Allow me to guide you through an example that showcases the elegance and power of KoolReport.

Imagine you wish to create a column chart to visualize the spending amount of each customer in your MySQL database. With KoolReport, accomplishing this becomes a breeze. Let's dive into the code:

use \koolreport\datasources\PdoDataSource;
use \koolreport\widgets\google\ColumnChart;

// Database connection information
$connection = array(
    "connectionString" => "mysql:host=localhost;dbname=sales",
    "username" => "root",
    "password" => "",
    "charset" => "utf8"

// Create a column chart to visualize the spending amount of each customer.
    "dataSource" => (new PdoDataSource($connection))->query("
        SELECT customerName, SUM(amount) as total
        FROM orders
        GROUP BY customerName

Impressive, isn't it? With just a few lines of code, you establish a connection to your MySQL database, retrieve the desired data, and generate a beautiful column chart displaying the spending amount for each customer. The simplicity and efficiency of KoolReport allow you to focus on the bigger picture rather than being tangled in cumbersome technicalities.

Moreover, KoolReport offers a diverse range of chart types to cater to your specific needs. From fundamental line charts and bar charts to intricate pie charts, area charts, geo charts, gauge charts, histograms, and combo charts, you have the freedom to unleash the full potential of your data.

What truly sets KoolReport apart is its seamless integration with multiple charting libraries. Whether you prefer Google Charts, ChartJS, Morris Chart, or D3, KoolReport has you covered. Thanks to its common API, transitioning between charting libraries is effortless. By merely changing the chart class, you can explore different visualization options without wasting precious time rewriting your entire transformation process.

In summary, as an aspiring developer, you now possess a powerful tool—KoolReport—to simplify your data visualization endeavors. This framework empowers you to streamline your development process, save invaluable time, and focus on creating impactful data visualizations. Say goodbye to convoluted data transformations and embrace a world where charting becomes an intuitive and seamless experience. With KoolReport by your side, you can elevate your data visualization skills and unlock a realm of possibilities.

KoolReport Releases

We are thrilled to announce a major release of KoolReport products with significant improvements. Upgrade is highly recommended.

Compatibility with PHP 8.2

Dynamic properties have been deprecated in PHP 8.2 causing issues for KoolReport and its packages. We have completely solved the issues with dynamic properties in this release, enabling you to upgrade to the latest PHP confidently.

KoolReport Core 6.1.0

Improvements have been made to Table, Google Chart and the ability to store the view folder in a separate folder. The view file of a report no longer needs to be in the same folder as the report’s class file.

Dashboard Framework

Exporting capabilities have been greatly enhanced with the addition of a general engine() method. This method enables you to specify a list of exporting engines that you need and choose which engine to use during the exporting process. Excel exporting has also been improved, allowing developers to customize the view of the excel file instead of using the default view from the previous version.

Other packages

  1. Datagrid 7.8.0: Ability to load custom css file
  2. Excel 10.6.0: Excellent improvement for MacOS Number compatibility and ability to rearrange widgets automatically in Excel files
  3. Export 5.3.0: Improve the flexibility of export view by adding viewMap property.
  4. VisualQuery 2.1.0: Fix the grouping when multiple fields are used
  5. Amazing 2.1.4: Fix FormDropDown and DonutChart in Dashboard
  6. AppStack 1.1.5: Fix FormDropDown and DonutChart
  7. Bootstrap4 1.5.1: Upgrade to 4.5
  8. ChartJS 3.2.1: Minor fix
  9. ChartTable 1.3.1: Minor fix
  10. Cleandata 1.6.1 :Minor fix
  11. CloudExport 4.2.0: Upgrade php client library
  12. Cube 3.5.1: Minor fix
  13. Inputs 6.5.1: Minor fix
  14. MorrisChart 3.0.1: Minor fix

We hope that you enjoy the new releases.

<3 koolreport team

Dashboard vs AdminPanel

You might wondering What are the differences between Dashboard and Admin Panel? What should you choose for your project?

As businesses grow, so does the amount of data they generate. It becomes increasingly important to collect, organize and analyze this data to make informed decisions. This is where dashboards and admin panels come in.

Both dashboards and admin panels are tools used to manage and analyze data, but they serve different purposes. An admin panel is typically used by an organization's internal team to manage the backend of a website or application. It provides access to the data and tools necessary to manage the functionality and content of the site.

On the other hand, a dashboard is a user interface that provides an overview of important metrics and key performance indicators (KPIs) for a business. It is designed to help stakeholders make quick, informed decisions based on real-time data.

While these two tools may seem similar, they serve distinct purposes. An admin panel is focused on managing and updating a website or application, while a dashboard is focused on presenting data and insights.

However, what if you could have a tool that combines both the functionality of an admin panel and a dashboard? That's where the Dashboard Framework of KoolReport comes in.

Built on top of the powerful KoolReport Pro, the Dashboard Framework is a set of ready-made features designed to make it easy for developers to create online dashboard applications or admin panels for websites. With just a few lines of code, developers can create a modern, single-page dashboard that includes built-in authentication, authorization, and support for multiple databases and data sources, including CSV and Excel files.

In addition, the Dashboard Framework includes support for multi-languages and multi-themes, making it easy to create custom dashboards that fit your brand and language preferences. And with widget lazy loading support, developers can ensure that the dashboard is fast and responsive, even when working with large datasets.

The Dashboard Framework is also flexible and can work within other popular PHP frameworks, including Laravel, CodeIgniter, Yii2, and Symfony. This makes it easy to integrate the Dashboard Framework into your existing workflow and start building great dashboard systems for your clients or your own business.

View Dashboard Framework Demo

In conclusion, while dashboards and admin panels serve distinct purposes, the Dashboard Framework of KoolReport makes it easy to create a tool that covers both functionalities. With its powerful features and flexible integration options, the Dashboard Framework is a valuable tool for any developer looking to build a modern, data-driven application.

KoolReport Major Releases

We are happy to announce that big release for KoolReport products have been available. This release contains many improvements to the library and it worths your upgrade.

Core 6.x

KoolReport Core has been improved its datasources for better connection. The library was also equipped with optional PHP generator mechanism to reserve resources to handle large data report. In previous version of KoolReport, we may experience some notices when working with PHP 8.x but now all are gone.

KoolReport Pro and its packages

Together with release of the core, KoolReport Pro also reached version 6.x with the upgrades of many packages:

  1. Amazing 2.1.3: Handle dashboard framework theme
  2. Inputs 6.2.0: Upgrade client library and fix bugs
  3. QueryBuilder 3.3.0: Fixed issue in from() methods
  4. ChartJs 3.2.0: Ability to handle chart's onClick events and able to use inline plugins.
  5. Charttable 1.3.0: Ability to transpose table with flexible column names
  6. Cube 3.5.0: New methods like count distinct, count not null and sum distinct.
  7. Datagrid 7.7.0: Smart searching mode, complex header labeling.
  8. Excel 10.5.1: Fixed bugs, adding footer with aggregating methods
  9. Pivot 9.0.1: New methods like count distinct, count not null, new computations property for Pivot2D

New AppStack theme

Beside existing Amazing theme, we have provided a new theme called AppStack. The theme has been added into KoolReport Pro that you can try out now.

Dashboard Framework 4.x

This new version of Dashboard Framework contains so many improvements that you should upgrade:

  1. Dynamic themes: The theme now can be set during runtime, it opens the possibility for users choose the theme that they like.
  2. Dynamic languages: Able to let user choose their preferred languages
  3. Multi pages: Can have more than one page with different menu system.
  4. FlexView: A new widget of Dashboard that can hold and show different views.
  5. InlineEditAction: New action for admin panel that allows resource be edited right on table
  6. Compability: Working with latest PHP 8.x version.

Read our Dashboard 3.5 to 4.x upgrade notes.

Thank you very much!

<3 koolreport team

5 Reasons You Should Use KoolReport

Reporting section is always a part of any system, sometimes it plays a crucial part. We have learnt this through hundreds of projects we did for our customers. So what is KoolReport and why you should consider having it in your great php application.

php report

What is KoolReport?

By definition, KoolReport is an intuitive and flexible open-source PHP Reporting Framework for faster and easier data report delivery. Just like any php framework like Laravel or CodeIgniter, KoolReport provides developers a frame to code, a list of ready-made functionalities to build things. While other frameworks focus on constructing web applications, KoolReport only focuses on one thing: using PHP to construct great data reports.

Koolreport was born from the fact that data reports appear very often in almost all web applications. It is understandable because we always need to know the status of applications such as number of visitors, number of registered users or number of item sales and so on. We have built several hundred applications for our customers and 90% have report sections. In some of them, the report section is actually the main part. This is the biggest motivation for us to construct KoolReport in the first place.

There are 5 reasons that you would like to have KoolReport in your projects:


Easy to install and easy to use. You can install KoolReport by either downloading a copy and putting it inside your application or by using composer with a single command line. The structure of a report is very simple, one php class for report’s definition and one view file for report’s visualization. That’s why you can start using KoolReport in almost no-time.

Single purpose

KoolReport only does one thing and only one thing: building a good data report. Nothing more. You will not see routing, authentication or whatsoever. Is it bad? It depends on each opinion but for us, doing one thing best is better. “Make a good report” is not a simple task in fact. It includes 3 things.

First is the ability to connect to various sources and bring in data in one place. A report could be combined results from different data sources, a little from MySQL, some in Postgresql and other from CSV.

Second is the power of data processing. Data is gathered but how to fastly combine and transform them into meaningful information is the question. KoolReport contains over 30 built-in data processes which you can use with your data.

Last is data visualization capability. We have all meaningful data but without a good representation, the story could not be told. KoolReport is integrated with rich charts and graphs that come from well known libraries such as Google Chart, D3 or ChartJs for you to convey your data in the most impressive and interactive way.

Work with different environments

KoolReport can be integrated into Laravel or CodeIgniter or any MVC frameworks out and utilize their functionalities not existing in KoolReport. So KoolReport wants to be part of ecosystems, does one good thing and corporate with others, all heading to a final purpose: A great application.

Inherit experience of data report maker

Our deep experience of making data reports has been put into KoolReport. Moreover, the comments, recommendations and error report from users helps us to perfect KoolReport through many years. So using KoolReport, you are using a proven framework made by experts and growing from real use cases.

Free and open-source

Cost is always a part of the decision as always. KoolReport is released as a free and open-source library under MIT license which virtually gives you full right to use, to access and modify source-code as your own need.

So above are the top 5 reasons that you should use KoolReport inside your project. Of course, any solution has drawbacks and KoolReport will not be an exception. The reasons we give could be biased and the best way is your own experience with the framework.

KoolReport helps to analyze your data and ultimately turn them into visual reports or dynamic dashboards.

"KoolReport helps me very much in creating data report for my corporate! Keep up your good work!"

Alain Melsens

"The first use of your product. I was impressed by its easiness and powerfulness. This product is a great product and amazing."

Dr. Lew Choy Onn

"Fantastic framework for reporting!"

Greg Schneider
Get KoolReport Now, It's FREE!