How To Find CodeIgniter Application Version Tutorial

Reading Time: 3 minutes
5,380 Views

Inside this article we will see the concept i.e How To Find CodeIgniter Application Version Tutorial. Article contains the classified information about How To Check version of Codeigniter Framework.

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 get started.

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.

<?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 How To Find CodeIgniter Application Version Tutorial in a very detailed way.

Online Web Tutor invites you to try Skillshike! Learn CakePHP, Laravel, CodeIgniter, Node Js, MySQL, Authentication, RESTful Web Services, etc into a depth level. Master the Coding Skills to Become an Expert in PHP Web Development. So, Search your favourite course and enroll now.

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.

1 thought on “How To Find CodeIgniter Application Version Tutorial”

  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.