Find Which CodeIgniter 4 Version Using ?

Share this Article
Reading Time: 2 minutes
15 Views

In CodeIgniter 3, we have a constant variable to see CodeIgniter version i.e CI_VERSION. But in CodeIgniter 4, we have some different approach.

Note*: For this article, CodeIgniter v4.1 setup has been installed. May be when you are seeing, version will be updated. CodeIgniter 4.x still is in development mode.

Let’s see from Installation.


Download & Install CodeIgniter 4 Setup

We need to download & install CodeIgniter 4 application setup to system. To set application we have multiple options to proceed. Here are the following ways to download and install CodeIgniter 4 –

  • Manual Download
  • Composer Installation
  • Clone Github repository of CodeIgniter 4

Complete introduction of CodeIgniter 4 basics – Click here to go. After going through this article you can easily download & install setup.

Here is the command to install via composer –

$ composer create-project codeigniter4/appstarter codeigniter-4

Assuming you have successfully installed application into your local system.


Find CodeIgniter Version ?

We have two options to see where we can find it. First either by going through the located file and second we can print the version by Constant.

Version Located File

Need to go installed setup and find this path & file – /vendor/codeigniter4/framework/system/CodeIgniter.php

Inside this CodeIgniter.php file, you should see we have a class named with CodeIgniter and a constant in that class as const CI_VERSION = ‘4.1.1’;

This 4.1.1 in my case, in your case it may be different due to new released versions.

Print CodeIgniter Version in application

Inside this we need to use same CodeIgniter class by the help of it’s namespace. Have a look, we have created a controller to print the value.

<?php

namespace App\Controllers;

class Home extends BaseController
{
    public function showVersion()
    {
        echo \CodeIgniter\CodeIgniter::CI_VERSION;
    }
}

We hope this article helped you to learn about to find CodeIgniter 4 application version in a very detailed way.

If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.

Find More on CodeIgniter 4 here

1 thought on “Find Which CodeIgniter 4 Version Using ?”

  1. Thank you for some other excellent article. The place else could anybody
    get that type of information in such an ideal way of writing?
    I have a presentation subsequent week, and I am at the look
    for such information.

    Reply

Leave a Comment