Welcome Guest, Not a member yet? Register   Sign In
Please use snake_case. not CamelCase
#1

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?
Reply
#2

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.
Reply
#3

(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
Reply
#4

(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?
Reply
#5

(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
Reply
#6

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
Reply
#7

Oh okay, thanks for clearing this up for me!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB