The KoolReport Blog

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

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

PHP Dies Or Not?

PHP has had better days, for sure. But is it really dead? On a forums like Stack Overflow people are suggesting that PHP is dead. Do they have a valid point, or could it be that they just don’t like PHP? Let’s take a look at PHP and see if there is a future for this programming language.

PHP Is Still Dominating The Web

If you take a simple look at the numbers PHP is definitely not dead. PHP is the most used server-side programming language by far. Approximately 75 percent of all webpages are powered by PHP. It is fair to conclude that PHP isn’t dead based on this statistic since 75 percent is far too high number for a dead language!

One of the reasons that PHP is used by so many websites is because WordPress uses PHP. The market share of WordPress is approximately 34 percent of all websites. That’s 75 million websites using WordPress. Furthermore, there are some other CMS’s like Drupal (3%) and Joomla(2%) which also have a significant share of the market. And there are some popular shop management systems, like Magento, which have around 1 percent of the total market share.

A lot of big content and shop management systems are using PHP, which makes PHP important and relevant.

Building Websites From Scratch

I can see the argument about building websites from scratch since a lot of people, who use WordPress for example, don’t know how to code. Making a website in WordPress does not require you to know how to code. A lot of people who have a WordPress website probably don’t even know that it’s powered by PHP. So is PHP still used by people who build websites from scratch?

PHP was and still is a very popular language. One of the reasons for this is that it’s a really easy programming language to learn. That makes it an excellent language for people new to building websites. PHP can be learned without any prior knowledge. I think it’s fair to say that most web developers that have been around for a while probably started out with PHP, or at least have worked with PHP at some point.

Programming

Since PHP has been around since 1994 the language has got a little cluttered over time. There are a lot of ways to build the same functionality and a lot of these ways are pretty hacky. This makes it easier to write bad code in PHP. Obviously, it’s possible to write bad code in any language but PHP makes it a little easier because of the way it has grown.

PHP has been around so long it also has a lot of old stuff. This makes it easy to get started with PHP, but if you stick to the old solution you end up with suboptimal code that doesn’t follow best practices. And this is something that you should really try to avoid. Not following the best practice is something that will happen when you’re inexperienced with PHP since it is not always clear what the best solution is. This is because there are a lot of ways to solve the same problem. This is one of the reasons why PHP is hated by some developers.

On the other hand, you could argue that most web developers don’t write raw PHP. Most of the times you will be using some sort of framework that does a lot of things for you. A popular PHP framework that is very clean is Laravel. The advantage of working with a framework is that a lot of the dirty work is done under the hood. The framework forces you into writing cleaner code.

PHP 7

Since the release of PHP 7 a lot of new features and improvements have been introduced. The two most significant improvements are improved speed and better memory usage. This means that websites that use PHP 7 load faster than websites that use an older version of PHP and can handle more users at the same time.

Code wise, type declarations and new operators have been introduced. Error handling has also been improved.

Jobs

Since 75 percent of the web is powered by PHP there will obviously be a lot of jobs involving some sort of PHP coding. All these websites need to be maintained and there are PHP developers needed for that. The enormous market share of PHP won’t be gone overnight, so jobs involving PHP will be around in the future.

If you take a look at this link to the jobs section of Stack Overflow you will find a lot of jobs that require PHP.

Conclusion

Although there is a lot of discussion about the future of PHP, it is clear that PHP does have a future. It is by far the most used programming language for websites.

PHP has been around for a while now and this is reflected in the code. There’s a lot of old stuff that means the best solution is not always clear. Code wise you could use a framework that does a lot of the dirty work for you and forces you to write cleaner code. However, since the introduction of PHP 7, a lot of things have improved.

If you want to start a career as a PHP developer you won’t run out of options when it comes to finding a job. There are plenty of jobs involving PHP skills and this will stay the same in the near future. So what do you think about PHP? Do you think there is a future for this programming language? Or is it dead?

Thanks for reading!

<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!