The KoolReport Blog

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

Google Charts is required to update

Recently, Google has updated its Charts library. As a result from this update, your chart may not render properly and could receive error while rendering. We acknowledged the issue and has acted fast to provide the hot fix in new KoolReport 4.7.0. Please upgrade!

In this version, we provided some other updates to make sure everything working great. First, the KoolReport's resource manager is improved to better generate resource folder. Second, KoolPHP Table is enhanced with added average calculation in footer and with the fix of row click event in the header of table.

Together with new core 4.7.0, we released KoolReport Pro 4.7.0 with new package's updates:

  1. CloudExport 2.1.1: Upgrade ChromeHeadlessio core to support multi language and font load.
  2. Cube 3.1.0: Adding finalValue property for custom aggregation
  3. DataGrid 4.0.0: Ability to load plugins
  4. Excel 7.2.0: Fix bugs, more excel chart's options, upgrade core MS PHPSpreadSheet.
  5. Export 4.1.0: Adding default parameters for pdf() method.
  6. Inputs 5.5.0: Upgade core javascript library
  7. QueryBuilder 2.5.1: Able to rebuild query from array data.
  8. Pivot 6.3.0: Adding finalValue property for custom aggregation

Thank you very much!

<3 koolreport team

Coronavirus: How can we help?

This is an unprecedented time in our history. The COVID-19 pandemic is having an impact on the health of our loved ones, the businesses we rely upon, the health of the global economy, and the way we live our daily lives. Although small, we would like to contribute our effort to help.

We are here to help our customers

We stand ready to help you with safe, secure and affordable reporting solution. KoolReport framework is continued to improve with new features and bug fixes to ensure your report application relied on us continue to run well. We are working hard to fulfill our support responsibility to our customers and all KoolReport's users. We continue to get outsourcing projects done even our customers may be late on payments. We truly understand "a friend in need is a friend indeed".

Discount our licenses

In this flat world today, every businesses is connected to each others. Crisis somewhere else reach us in the way I could not think of. Job loss, project halted, late payment, all can happen putting financial burden in our shoulder. That's why we discount 40% for all KoolReport Pro licenses during this hard time. We understand and would like to share the burden with you.

Take care of our employees, who serve you

Supporting our employees during this crisis period is critical to providing you the service you need and expect. We have taken actions as Covid-19 spreads to protect the physical health and financial security while supporting our customers. Our employees are allowed to work remotely. We provided them with tools to work effectively from home. During their transition from workplace to home, you may see some impact of wait time for our support answer. We greatly appreciate your patience and understanding as we work through this together.

Thank you

We would like to say thanks to all for your trust you put in us everyday. We believe that the crisis will be gone soon and we together be back stronger than ever.

<3 koolreport team

10 PHP Libraries That You Should Not Miss

It has been 25 years since the first version of PHP in 1995. Despite of its age, PHP is still one of the most programming languages in the world and be the top choice of many back-end developers. Let look at 10 PHP libraries that you need to know.

Most Used PHP Libraries

1. PHP-ML

https://github.com/php-ai/php-ml

A new way to approach Machine Learning (ML) in PHP, PHP-ML is an interesting library to work with. It provides you an easy way to use API training your bot to do prediction based on your inputs. It contains a series of algorithms to recognize patterns and performs complicated statistics.

PHP Machine Learning

2. Opauth

https://github.com/opauth/opauth

This library allows users to authenticate via their personal account on social networks or other services. Of course, it includes all the big names: Google, Facebook, Twitter, Github, Instagram, LinkedIn.

PHP Authentication

Opauth is supported by many PHP Frameworks, it is easily to be integrated in almost all current PHP applications such as: vanilla (plain) PHP applications, CakePHP, CodeIgniter, FuelPHP, Laravel, PrestaShop, and many more.

3. PHPMailer

https://github.com/PHPMailer/PHPMailer

No PHP library collections is perfect without PHPMailer - an complete email library for PHP. This project is supported by large community and being used in very popular applications such as Wordpress and Drupal. That makes it become first choice for sending email in PHP. It supports SMTP, HTML email and more..

PHPMailer

4. ImageWorkshop

http://phpimageworkshop.com/

ImageWorkshop is open-source PHP library allowing you to work with image layers. With it, you can easily change image size, crop, create thumbnail, adding watermark and more. Here is some example:

PHP Image Library

ImageWorkshop is developed to make your most common work on image in the easiest way. If you need more powerful library, you can look for Imagine library.

5. Carbon

https://github.com/briannesbitt/Carbon

Carbon is a great open source library to deal with datetime with various class and methods. For example:

PHP Datetime library

6. Ubench

https://github.com/devster/ubench

Ubench is a small library to check performance of your PHP code. It measures your code execution time as well as the needed memory. Using Ubench during your application development is a good idea as it can help to analyze, detect and enhance your code quality, ultimately improve the performance of your application.

Ubench

7. Faker

Faker is a PHP library to create fake data. It is very convenient and easy to use when you need an experiment database or sample data for your web application. Let look at some sample code:

PHP Fake Data

Every time you call properties of the object, a new random data will be generated.

8. Omnipay

https://github.com/adrianmacneil/omnipay

Omnipay is a payment library for PHP. It has a clear and coherent API and support various payment gateway. With this library, we only need to work with one API and work with different payment options. Because of using single unified API, we can easily use many gateways at same time or switch between them when needed.

PHP Omni payment

9. PHPGeo

https://github.com/mjaschen/phpgeo

PHPGeo is an simple library that allows us to calculate geographical distance between coordinates with high precision. This library support well those applications working based on geo locations. In order to get the coordinates, you can use location api of HTML5 or Yahoo api.

PHP Geo Library

10. KoolReport's Google Chart

https://github.com/koolreport/core

KoolReport is an good open source PHP library to provide reporting capability for your application. Google Charts is part of KoolReport can bring you good and free php chart solution. It provides more than 20 most common & advanced charts. The code is very simple to use:

ColumnChart::create([
    "dataSource"=>[
        ["category","amount"],
        ["Computer",100],
        ["Laptop",50],
        ["Tablet",80],
        ["Phones",150],    
    ]
]);

You may view more examples

Conclusion

Above are 10 most popular libraries that you can use to power your php application. Hope that our share is useful.

<3 koolreport team

PHP 7.4: Top 5 Advanced Features That You Need To Know

PHP 7.4 has been released in Nov 28th, 2019 with new syntax and significant performance enhancement. Let look at the top 5 cool features of PHP 7.4 that you should know.

PHP 7.4 Top 5 advanced features

Since PHP7, we have seen the incredible changes in PHP from its syntax improvement to its speed and efficiency. Since the emergence of new language like NodeJS, GoLang, there are always rumor whether PHP is going to die but believe me PHP still move forward and be stronger day by day. It is no wonder that for the second year in a row, PHP is among the top 10 most popular programming languages according to StackOverflow Developer Survey 2019. This year, it took the 8th place which is one rank higher than in the previous year.

PHP 7.4 has been released in Nov 28th, 2019 with new syntax and significant performance enhancement. Let look at the most top 5 cool features of PHP 7.4 that you need to know. Let started!

Arrow function

If you are using ES6 in Javascript, probably you have been familiar with arrow function. The arrow function helps to reduce syntax when we write anonymous functions. So now instead of writing this:

function do_double($n)
{
    return $n*$n;
}
$a = [1,2,3];
$b = array_map("do_double",$a);

With PHP 7.4, you can do:

$a = [1,2,3];
$b = array_map(fn($n) => $n*$n, $a);

As a result, your code will look cleaner & neater, allowing you to save much development & debugging time.

Typed properties

This new feature is considered one of the most important features in PHP 7.4. Previously you need to use getter and setter in order to check types of variables. Now you can easily specify type for class's variables:

class SaleReport
{
    protected int $month;
}

Due to declaration types (excluding void and callable), you can use nullable types, int, float, array, string, object, iterable, self, bool, and parent.

If developer try to assign irrelevant value from the type, he or she will get TypeError message.

The same like arrow function, typed properties will reduce work for developer and make code cleaner and shorter.

Preloading

Finally, preloading is supported in PHP, which will help to improve performance. As you may know, each time you page is requested, the code files will need to read and loaded into memory to execute. Preloading, in simple word is process of loading code files into OPcache to execute faster. It will eliminate I/O process which consume time and resource, hence your page will response quickly.

When you use OPcache, the executed files will be first loaded into memory and will be checked for changes for next time. Preloading will let developer specify certain files to be loaded into memory and stay there. It will help to save time for OPcache to check changes in those files, thus, increase the performance.

PHP 7.4 Preloading performance comparison

It is also noteworthy to mention that during preloading, PHP also eliminates needless includes and resolves class dependencies and links with traits, interfaces, and more.

Covariant & Contravariant

At the moment, PHP has mostly invariant parameter types and invariant return types which presents some constraints. With the introduction of covariant (types are ordered from more specific to more generic) returns and contravariant (types are ordered from more generic to more specific) parameters, PHP developers will be able to change the parameter’s type to one of its supertypes. The returned type, in turn, can be easily replaced by its subtype.

Coalescing assign operator

Below are the most common code that you will see in almost all projects:

$country = isset($_GET['country']) ? $_GET['country'] : 'unknown';

With PHP 7.4, now you can do:

$country = $_GET['country'] ?? 'unknown';

or a little complicated, you can do:

$country = $_GET['country'] ?? $_POST['country'] ?? 'unknown';

A spread operator

Another interesting feature in PHP 7.4 is the spread operator in array. Previously, you may need to use array_merge() to complete in complicated way. But no more, you can do this in PHP 7.4.

$parts = ['apple', 'pear'];
$fruits = ['banana', 'orange', ...$parts, 'watermelon'];

As you notice the ..., the array $part will be spread at right place in $fruits array. This is another feature that help developer to produce cleaner code and also save time on debugging.

Conclusion

There are several other updates in PHP 7.4 that we have not covered yet. Above are the features that we think the most important and that we need to know. As you may be aware that we are working on KoolReport, an PHP framework specializing in data report so keeping update with new features of PHP is a must for us. By utilizing new PHP features, we can improve the way data report should be created and ultimately make developer's life easier.

php

KoolReport 4.5.1 has been released!

We are happy to announce that we have released KoolReport core version 4.5.1 with new features. The KoolReport Pro also reaches same version number 4.5.1 with the new core update and the upgrade of individual packages such as Excel, Inputs, D3, ChartJs.

KoolReport's class

KoolReport's class is provided with new getXml() method to get the representation of your report in xml format. The xml contains both data and meta data of all report's datastores.

DataStore

In this version, we continue to enrich methods of datastore. DataStore has a new method called distinct(). As the name suggested, distinct method will have you to get a list of unrepeated values from a column. Furthermore, Datastore is provided with new toArray() and toJson() methods to get array and JSON. This could be useful if you need result in array form for further processing or JSON format to be returned in your REST API.

New DataSource

We have added new DataSource called ExistedPdoDataSource to handle source in case you only have the PDO object but connection settings. So you only need to send your existed PDO object as parameter to your report and provide it with ExistedPdoDataSource in settings() method.

JsonSpread process

JsonSpread is a new processed added to KoolReport in order to spread JSON data into column in data stream. By doing so, we are able to apply other KoolReport's processes to further process the JSON data.

Support CI/CD process

Since the popularity of CI/CD process, KoolReport library now fully support this new type of software integration and delivery processes. We understand the 1 hour token availability causes trouble for the automation delivery so we have increases the life time of token to maximum. In particular, the token will last until your subscription of KoolReport Pro is ended. If you have purchase the Perpetual Usage, the token expiration will be set the 2100-01-01 which is virtually life-time or never expired.

Support load balancing

If you are using load balancing with multiple servers containing app (with KoolReport integrated), the generated resource folders now have same name in all servers. So virtually, the client-side will be able to receive resource files regardless of servers it connects to.

D3Chart Client Events

The D3 chart has been upgraded with one of the most crucial features: client events. This is the missing part in D3 first version. Now all charts support itemSelect event which help you to track the click of user to item on the charts. Now D3 is able to work with DrillDown package to provide interactive drill down report.

DrillDown supports D3

Missing client events hindered the collaboration of DrillDown package with D3 chart. But not anymore, since the D3 package has supported the client events, the DrillDown package also support generate D3 Chart. By specifying the D3 chart as drilldown widgets, the DrillDown will bind itself to D3 itemSelect to provide interactive report.

Excel Package

We have fixed the PieChart display in Microsoft Excel and a minor bugs happened when data is missing.

ChartJS Package

We have upgraded the core of ChartJS to latest version of 2.9.x. With this new upgrade, some of known issues has been addressed. Furthermore, we have provided new plugins property which allows you to use most popular plugins for ChartJS like datalabels, annotation, stacked100 and others.

Inputs Package

Due to the upgrade of FontAwesome library in previous KoolReport's version, some of the icons have not been displayed correctly. This issue has been addressed in this new version of Inputs package.

New Yii2 Package

In this release, we roll out new package koolreport\yii2. As the name suggested, yii2 package will facilitate the integration of KoolReport with Yii2, one of the most used frameworks in PHP. Similar to other integration packages that we have created before like laravel or codeigniter, the yii2 package will help to auto configure report's assets settings and allow report to access to default database connection setup within Yii2.

Summary

The version 4.5.x added new features and empowered reporting capability to KoolReport. This upgrade is backward compatible with old 4.x versions so feel free to upgrade. If you need have any question about this new release, do not hesitate to let us know.

Thank you!

<3 koolreport team


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!