Skip to content
Related Articles
Open in App
Not now

Related Articles

How to check the CodeIgniter version ?

Improve Article
Save Article
Like Article
  • Last Updated : 02 Mar, 2022
Improve Article
Save Article
Like Article

PHP has many frameworks like Laravel, CodeIgniter, etc., but “Codeignitor” is one of the popular MVC frameworks of PHP. Most of the developers prefer to make their projects on Codeignitor because it is very lightweight and also its documentation is easy to understand. Some of the features and advantages or why use Codeignitor and its benefits are given below:

  1. It’s very fast and lightweight because its library takes less memory.
  2. Easy to learn to make a project of level.
  3. Clear documentation to understand.
  4. Easy error handling and debugging.
  5. Deal with security issues.
  6. Large support of the community.
  7. Paging and encryption support, file uploading class available, an inbuilt class for sending an email.

How to use CodeIgniter?

In order to use CodeIgniter, we have to install Codeigniter and there are two ways to install CodeIgniter:

  • Using Composer
  • Manually

1. Using Composer: In order to install CodeIgniter through composer first, we need to install composer in order to that download and install composer you can follow here in detail Composer. So after installing composer we’ll install/download the CodeIgniter inside our htdocs folder inside our xampp folder like below:

composer create-project codeigniter4/appstarter project-name

The command above will create a “project-name” folder which will be our root folder for our development. If you change the “project-name” argument, the command will create an “appstarter” folder with the following name, which can be renamed after as needed. If you don’t want PHPUnit installed, and want all of its composer dependencies, then add the –no-dev option to the end of the above command line and that will result in only inside the framework folder named, and the three trusted dependencies that we bundle, being composer-installed.

  • Benefit:-Simple installation and easy to update.
  • Loss:-You still need to check for app and Config changes after updating.

2. Manually: It is the easiest way to all you have to download and just run. In order to download the framework you can download it from here CodeIgniter and after downloading you have to extract your downloaded CodeIgniter file inside the htdocs folder of your xampp folder. You don’t have to face any problems in managing the settings.

  • Benefit: Download and run.
  • Loss: You are responsible for merging conflicts when updating.

How to check the CodeIgniter Version?

To explain how to check the CodeIgniter version I’m using CodeIgniter4 but you can use any other version of CodeIgniter also. There are two methods to check our CodeIgniter version and we’ll try to understand each below:-

Method 1: CodeIgniter makes the task easy and stores its current version number in a global constant named ‘public const CI_VERSION’. It is defined in a core file that you can open and check out directly, just go to root_folder/vendor/codeigniter/framework/system/Codeigniter.php and look for the lines.

As you can see in line 48 it’s written by default that “CI_VERSION = ‘4.1.8’; ” is in use for the following CodeIgniter app named PROJECT.

The CodeIgniter version can be different for different users as per their respective downloads, here we’re using CodeIgniter4.

Method 2: In this method follow the following steps below:

Step 1: In this, you have to create a new view file inside the views folder as I have created by naming the file CI_ver.php you can do the same and name the file whatever you want or you can make changes in the given by default file welcome_message.php.

If you’re using CideIgniter3 then the folder structures and file structure would be different but in that case, also all you have to do is create or edit the view that is given inside the Views folder and write the following code in it and follow the next steps as given.

    echo CI_VERSION;

Step 2: Go to the controller’s folder inside your project/app folder then you can create your own controller or you can use the same that is given by default.


My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!