Which version of CodeIgniter am I currently using?
Asked Answered
A

7

245

Quick question.

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

Thanks.

Apache answered 4/2, 2010 at 1:30 Comment(3)
Is CodeIgniter still used widely in php?Monthly
@Monthly not really, although there's version 3 now. This was asked in '10 though, CI has seen more use in those times.Institution
Actually it is well mantained, it is still a good option for ligth weigth framework users.Ore
H
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
Hatti answered 4/2, 2010 at 1:59 Comment(7)
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.Mcneese
In newer versions CodeIgniter.php is located in /system/core folder.Attestation
@downvoter: Why the recent downvote on this answer? Is something incorrect?Hatti
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?Giselle
@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.Hatti
@ThomasDaugaard yea, this is the best answer i think. no need to be downvotedWeymouth
If you are in linux, go to the directory where code igniter is installed and use the command grep -ir "ci_version" ./Pentadactyl
M
125

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

define('CI_VERSION', '3.1.8');
Monthly answered 12/3, 2013 at 13:38 Comment(5)
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?Kummerbund
@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.Ruscher
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.Kummerbund
You can find the file using 'locate CodeIgniter.php' and then cat file | grep -i versionTwotime
In Codeigniter 4, the CI_VERSION is defined in system/CodeIgniter.php. Look for it in vendor/codeigniter4/framework/…Tenor
D
15

You should try :

<?php
echo CI_VERSION;
?>

Or check the file system/core/CodeIgniter.php

Dratted answered 2/12, 2016 at 6:10 Comment(0)
S
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';


Steroid answered 15/4, 2019 at 17:43 Comment(0)
C
5

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

<?php
   echo CI_VERSION;
?>
Curhan answered 23/9, 2016 at 18:53 Comment(0)
O
4

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

Oconnell answered 11/11, 2019 at 9:16 Comment(0)
G
3

For CodeIgniter 4, use the following:

<?php    
    echo \CodeIgniter\CodeIgniter::CI_VERSION;
?>
Goode answered 21/10, 2019 at 15:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.