KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Getting KoolReport version programtically #1927

Open Keith Burke opened this topic on on Feb 26, 2021 - 3 comments

Keith Burke commented on Feb 26, 2021

When a new version of KR is released SOMETIMES the version number isn't updated [wasted about 5 minutes realising this on 5.0.4 as it reports 5.0.1. Slap slap devs], I implemented a quick version number check.

Put this where you need it. For me, it's inside a CodeIgniter sub view. It's nice to report version number in the dev / staging environment as a sanity check.

You have to instantiate the class as the version function is non static in KoolReport.php :(

    $koolreport =  new \koolreport\KoolReport();
    echo $koolreport->version();
KoolReport commented on Feb 26, 2021

Oh, 5.0.4 is referring to KoolReport Pro which contains KoolReport version 5.0.1. Many times we release new version of KoolReport Pro because other add-on package is updated, but not because the KoolReport core updated. So the $koolreport->version() is actually version of KoolReport(core), not KoolReport Pro. If you want to check the version of KoolReport Pro, better you read the the koolreport/pro/composer.json, look for the property version. The code will be something like this:

$pro = json_decode(file_get_contents("vendor/koolreport/core/composer.json"),true);
echo $pro["version"];

Hope that helps.

Keith Burke commented on Feb 26, 2021

Ah, that makes more sense. Cheers.

Keith Burke commented on Feb 26, 2021

So, for the likes of myself, being old school, I don't use composer to install. I just download the zip file from my licenses section and extract. The filename says 5.0.4 but searching all extracted files from the zip, I don't see any other file containing text "5.0.4". Am I right in saying that the addon version is only set via composer and not in the zip download?

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
wiki

None