4

I'm writing an add-on and need to check the current EE version from PHP. What is the best way to get the current ExpressionEngine version?

4

One option would be to use the APP_VER constant. You can see it here with a few other version constants as well:

http://ellislab.com/expressionengine/user-guide/development/constants.html#version-constants

This will give you the version number with decimals unlike Adrian's solution so, pick which route you'd like. For example:

if (APP_VER == '2.5.3')
{
   do something;
}
| improve this answer | |
  • 1
    Ha, I just realized it was you who asked this question! And yes I will sleep a little smarter tonight knowing I knew something you didn't ;) – Natetronn Dec 16 '12 at 2:46
1

You can use $this->EE->config->item('app_version') which returns a string like 253.

I'm not sure whether this is the most reliable way to determine the version number though, or whether it's possible to get the version number including decimals.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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