Find Which CodeIgniter 4 Version Using?

Share this Article
Reading Time: 2 minutes

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.

Learn CodeIgniter 4 Basics in a quick tour, Click here.

Learn More –

Let’s see from Installation.

CodeIgniter 4 Installation

To create a CodeIgniter 4 setup run this given command into your shell or terminal. Please make sure composer should be installed.

$ composer create-project codeigniter4/appstarter codeigniter-4

Assuming you have successfully installed application into your local system.

Environment (.env) Setup

When we install CodeIgniter 4, we will have env file at root. To use the environment variables means using variables at global scope we need to do env to .env

Either we can do via renaming file as simple as that. Also we can do by terminal command.

Open project in terminal

$ cp env .env

Above command will create a copy of env file to .env file. Now we are ready to use environment variables.

Enable Development Mode

CodeIgniter starts up in production mode by default. You need to make it in development mode to see any error if you are working with application.

Open .env file from root.

# CI_ENVIRONMENT = production

 // Do it to 
CI_ENVIRONMENT = development

Now application is in development mode.

Find CodeIgniter Version?

We have two options to see where we can find it. First either by going through the located file (Core File) and second we can print the version by a codeigniter 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.5’;

This 4.1.5 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.


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.

Buy Me a Coffee

Online Web Tutor invites you to try Skillshare free for 1 month! Learn CakePHP 4, Laravel APIs Development, CodeIgniter 4, Node Js, etc into a depth level. Master the Coding Skills to Become an Expert in Web Development. So, Search your favourite course and enroll now. Click here to join.

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.

Was this post helpful?

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.

Comments are closed.

Learn Web Development Courses Risk Free @ $5 only.
Web Development Courses @ $5