Welcome Guest, Not a member yet? Register   Sign In
Codeigniter using namespace for version 3.x?
#1

why not use the namespace in codeigniter app?
Hocphp.info - Learn Codeigniter starting from the basics correctly with this Codeigniter tutorial
Reply
#2

Because CI3 support PHP 5.2.4 and namespaces introduced in PHP 5.3
Reply
#3

You can use namespaces in your application, but CI itself doesn't use them, and its loader doesn't support them, so you'll have to load namespaced classes on your own. Since CI will load Composer for you if you set a config value, it's usually pretty easy to load and use namespaced classes as you would in other frameworks.
Reply
#4

I try to do but I need more details or a sample, could you please write a little sample using ci3 hmvc and namespacing
regards
Reply
#5

No you can't use namespace in ci 3.x version until core files change.
I suggest you to not using namespace in core files like controller,model and default libraries.
But u can use namespace in extra added libraries with composer. google it composer autoloader.
Reply
#6

You can't use namespaces in controllers.

You can use namespaces in models and libraries, but in that case you don't use $this->load->***.
You just instantiate them with new operator like pure PHP.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB