March 14, 2020
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.
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.
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.
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.
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..
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:
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.
Carbon is a great open source library to deal with datetime with various class and methods. For example:
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.
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:
Every time you call properties of the object, a new random data will be generated.
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.
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.
10. KoolReport's Google Chart
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:
You may view more examples
Above are 10 most popular libraries that you can use to power your php application. Hope that our share is useful.
<3 koolreport team
March 10, 2020
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.
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!
$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.
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:
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.
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.
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.
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.
February 7, 2020
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 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.
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
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.
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
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
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.
We have fixed the PieChart display in Microsoft Excel and a minor bugs happened when data is missing.
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
stacked100 and others.
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
yii2 package will help to auto configure report's assets settings and allow report to access to default database connection setup within Yii2.
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.
<3 koolreport team
December 5, 2019
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.
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.
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.
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.
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
November 24, 2019
The only occasion to get KoolReport Pro with this great discount. Owning the Pro license, you will access to all commercial packages and enjoy the privileges of Priority Support plus Free Upgrage.
The KoolReport Pro will save you tons of time & effort to construct a stunning data report: various charts, pivot tables, drilldown report, pdf & excel export and more..
Your purchase will be safe with our 30-days money back guarantee policy. If you are wondering whether you should buy, why don't just try when price is low. If it does not work for you, we will refund fully.
Happy Black Friday!
<3 koolreport team