CodeIgniter Forums
Global Abstract Class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Global Abstract Class (/showthread.php?tid=77514)



Global Abstract Class - shaunM_za - 09-10-2020

I've tried a few things, but nothing seems to do the trick, where is the best place to put a global abstract class eg:

abstract class GlobalTypes
{
    const Type1 = 'str_type_1';
    const Type2 = 'str_type_2';
    const XYZ'str_type_xyz';

    conts YES = true;
}

So GlobalTypes::YES needs to be available in the entire project.


RE: Global Abstract Class - InsiteFX - 09-11-2020

If you need the global and they do not change which constants do not change.

Just add the Constants to the ./app/Config/Constants.php file.

Or it may also work by putting it in the ./app/Common.php