If you're taking over an existing project you will likely need to know what exact version of CodeIgniter that you're using. This will help you determine which user guide to view, what features you can expect to have, and more. This article will take a look at a couple of different methods.

Do you have access to the command line?

If you can get to the command line for the project then the first thing you can try is to see what version of CodeIgniter 4 you might be running. At this point, version 4 has been out for several years so there's a good possibility your project will be running the newer version.

From the command line, within the project root, check and see if there is a file called spark. If there is, then it is version 4. You can run the following command to see the exact version:

php spark

This will list all of the cli tools available, but the very first line tells you the exact version that is running:

CodeIgniter v4.4.5 Command Line Tool - Server Time: 2024-03-05 23:31:38 UTC-06:00

What about earlier versions?

If you didn't have access to the command line, or there was no spark file available, you will have to check the source files to determine the current version of CodeIgniter.

CodeIgniter 4

For CodeIgniter 4 open up the file vendor/codeigniter4/framework/system/CodeIgniter.php. The first line after the class opening contains the version.

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

CodeIgniter 1, 2, or 3

For earlier versions of CodeIgniter you can find the answer in the file at system/core/CodeIgniter.php:

define('CI_VERSION', '3.1.13');

Programmatically

If you need to display the version within a view, like in an Admin page, you can always use the following code for version 4:

<?= CodeIgniter\CodeIgniter::CI_VERSION ?>

For earlier versions, you can use the constant:

<?= CI_VERSION ?>