3 Ways to Check Codeigniter Application Version

February 19, 2023
Codeigniter
3 Ways to Check Codeigniter Application Version

In this tutorial, you will learn how to check the Codeigniter Application version. We will be discussing 3 ways of checking the codeigniter application version.

Lets get started!

Method 1: Manually Check Codeigniter Version In file

In this first method, we will manually go to the file and check the codeigniter version. You need to go to app/vendor/codeigniter/framework/system/Codeigniter.php in which you will see the following code:

class CodeIgniter
{
	/**
	 * The current version of CodeIgniter Framework
	*/
	const CI_VERSION = '4.0.4';
}

In the above code, CI_VERSION is the codigniter version, which in our case is 4.0.4.

Method 2: Check Codeigniter Version Using Controller or View

This second method is pretty much straightforward, and only works for codigniter 4. So you just need to open the view or controller and type the following code:

<?php 
   echo \CodeIgniter\CodeIgniter::CI_VERSION;
?>

If you type the above code in the controller or view file, this will print the current version of Codeigniter of your application. Note again, this code only works for codeigniter 4, if you are using codeigniter 3 or blow, check the next method.

Method 3: Check Codeigniter Version Using CI_VERSION

In this method, we are using CI_VERSION variable to check the codeigniter version. Note the following code only works in codeigniter 3 or below:

<?php 
   echo CI_VERSION;
?>

In the above code, we are using CI_Version variable that will basically print the current Codeigniter version of the application.

Conclusion

Hope in the above article, you have learned 3 ways of checking codeigniter version. Let me know if you have any questions, See you in the next one 🙂

Write a Reply or Comment

Your email address will not be published. Required fields are marked *


Icon