Codeigniter using namespace for version 3.x? |
why not use the namespace in codeigniter app?
Hocphp.info - Learn Codeigniter starting from the basics correctly with this Codeigniter tutorial
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.
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
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.
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. |
Welcome Guest, Not a member yet? Register Sign In |