Defining Application Constants in Codeigniter

codeigniter, php

Solution

Not using `application/config/constants.php` is nonsense! That is the only place you should be putting your constants. Don't change the files in `system` if you are worried about upgrading.

Problem

I want to know a clean way of defining Application Constants in Codeigniter. I don't want to change any native file of codeigniter. Hence I don't want to define it in `application/config/constants.php` as when I need to migrate to newer version of code-igniter I will not be able to copy the native files of codeigniter directly. I created a file `application/config/my_constants.php` and defined my constants there. 'define('APP_VERSION', '1.0.0');' I loaded it using `$this->load->config('my_constants');` But I am getting a error `Your application/config/dv_constants.php file does not appear to contain a valid configuration array.` Please suggest me a clean way of defining application level constants in code-igniter.

Original source