245

Quick question.

Is there something similar to a phpinfo() - that would display the version for CodeIgniter?

Thanks.

3
  • 1
    Is CodeIgniter still used widely in php?
    – Timo
    Aug 8, 2017 at 10:21
  • 1
    @Timo not really, although there's version 3 now. This was asked in '10 though, CI has seen more use in those times.
    – Sebastianb
    Nov 16, 2017 at 13:23
  • 2
    Actually it is well mantained, it is still a good option for ligth weigth framework users. Mar 17, 2019 at 11:55

7 Answers 7

370

Yes, the constant CI_VERSION will give you the current CodeIgniter version number. It's defined in: /system/codeigniter/CodeIgniter.php As of CodeIgniter 2, it's defined in /system/core/CodeIgniter.php

For example,

echo CI_VERSION; // echoes something like 1.7.1
7
  • 5
    Correct. It's also in the commments of that file though, so no need to write or run code just to find out the version.
    – Fer
    Feb 11, 2010 at 14:20
  • 10
    In newer versions CodeIgniter.php is located in /system/core folder.
    – z-boss
    Jul 14, 2011 at 3:08
  • 3
    @downvoter: Why the recent downvote on this answer? Is something incorrect? May 11, 2012 at 11:05
  • Downvote because @Timo's answer is much more precise and this answer does not make any sense; why use a function to echo a constant when one could either just use the constant or echo it from a view or whereever it is needed? Jun 11, 2014 at 13:21
  • 6
    @ThomasDaugaard: A downvote implies the answer is not helpful. While I agree that the get_version wrapper is superfluous, the fact that I pointed out that this constant exists does answer the question and, I would argue, is helpful. Your point is taken, however, and I've edited to remove the get_version wrapper. Thanks for the feedback. Jun 12, 2014 at 0:44
125

Look for define in system/core/CodeIgniter.php:

define('CI_VERSION', '3.1.8');
5
  • 6
    Not sure why this isn't the accepted and popular answer. Who wants to run a php file/function to get it to spit out what's written right there? Jan 10, 2014 at 0:17
  • 8
    @TylerCollier Because thats what the question is, It asks if there is an option to spit out? I bet you read the question again before posting. Mar 4, 2015 at 4:30
  • 3
    You're right! I didn't think of 'spit out' in that sense, but I'm sure some people want to get to it programmatically. Mar 4, 2015 at 15:44
  • You can find the file using 'locate CodeIgniter.php' and then cat file | grep -i version Apr 25, 2019 at 19:40
  • 1
    In Codeigniter 4, the CI_VERSION is defined in system/CodeIgniter.php. Look for it in vendor/codeigniter4/framework/…
    – nJGL
    May 20, 2020 at 9:00
15

You should try :

<?php
echo CI_VERSION;
?>

Or check the file system/core/CodeIgniter.php

6

you can easily find the current CodeIgniter version by

echo CI_VERSION 


or you can navigate to System->core->codeigniter.php file and you can see the constant

/**
 * CodeIgniter Version
 *
 * @var string
 *
 */
    const CI_VERSION = '3.1.6';


5

From a controller or view - use the following to display the version:

<?php
   echo CI_VERSION;
?>
4

Please check the file "system/core/CodeIgniter.php". It is defined in const CI_VERSION = '3.1.10';

2

For CodeIgniter 4, use the following:

<?php    
    echo \CodeIgniter\CodeIgniter::CI_VERSION;
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.