Welcome Guest, Not a member yet? Register   Sign In
Traits & Interface

Hi everyone.

I need to know how to implement Traits & Interface on CI 2.x.
My doubt is, where I creat it? On Model, Controllers, Libraries? Where?

Everyone alredy use these features?
PHP is Life!!! SeeĀ My Portfolio

If it belongs to a library, I usually put them into the libraries folder and create a subfolder with the library's name (for example: I have a Notification library, then I create a folder in the libraries called Notification and put my own classes, interfaces etc. into that and I use require/include or an spl autoload function).
If it's anything else, then put it to application/third_party and put an spl_autoload to the front controller (main index.php).
If it is a complex stuff then create a PSR-4 compliant package and use composer's autoloader.

Thanks @orinstar. I'll try it.
Before your answer I tried use a library.
PHP is Life!!! SeeĀ My Portfolio

Theme © iAndrew 2016 - Forum software by © MyBB