CodeIgniter Forums
Please use snake_case. not CamelCase - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: Please use snake_case. not CamelCase (/showthread.php?tid=73931)



Please use snake_case. not CamelCase - kimho - 06-25-2019

I think PHP is Good when it use with snake_case not CamelCase.
CodeIgniter 3 is a wonderful Framework using snake_case.
Snake_case is very helpful in rapid development.
I hope CodeIgniter 4 should use snake_case too.
What do you think of this issue?


RE: Please use snake_case. not CamelCase - ciadmin - 06-25-2019

The CamelCase decision was made a few years ago, sorry.
snake_case is used for "legacy style" helpers or common functions.
There is nothing to prevent you from using snake_case in code that you write.


RE: Please use snake_case. not CamelCase - juworld - 09-25-2019

(06-25-2019, 09:35 PM)ciadmin Wrote: The CamelCase decision was made a few years ago, sorry.
snake_case is used for "legacy style" helpers or common functions.
There is nothing to prevent you from using snake_case in code that you write.

Hi there,

I notice that controller methods are still using snake_case? Is that the only exception?

Justin


RE: Please use snake_case. not CamelCase - ciadmin - 09-25-2019

(09-25-2019, 08:19 AM)juworld Wrote: Hi there,

I notice that controller methods are still using snake_case? Is that the only exception?

Justin

Which controller methods are you referrig to?


RE: Please use snake_case. not CamelCase - juworld - 09-25-2019

(09-25-2019, 08:43 AM)ciadmin Wrote:
(09-25-2019, 08:19 AM)juworld Wrote: Hi there,

I notice that controller methods are still using snake_case? Is that the only exception?

Justin

Which controller methods are you referrig to?

For controller methods that I build.

For example, if I added a new method in Home and call it go_home. I can visit this url by /home/go-home (in routes, I have $routes->setTranslateURIDashes(true);)

But, if I switch go_home to goHome, I have to use /home/goHome. using /home/go-home will give me a file not found

The way I can get around it is by adding home/go-home in Routes.php. Is that the best practice?

Please advice!

Justin


RE: Please use snake_case. not CamelCase - ciadmin - 09-25-2019

The camel case style rule is for code actually in the framework. Anything inside "app" can follow whatever convention makes sense to you.
So, you can keep your smake_case Smile


RE: Please use snake_case. not CamelCase - juworld - 09-25-2019

Oh okay, thanks for clearing this up for me!