Lowercase or CamelCase namespaces?


These are only examples. They’re not even recommendations - standard does not say anything about case of namespaces.

(Sidney Lins) #62

I said they are examples and I didnt say they are recommendations. But to me, the point is that, for some reason, they preffer to use StudlyCaps and they show that in all namespaces of all PSRs. Is not that the place where php devs are looking for examples and recommendations of standards? I think so.


This is example of consistency. Treating this as an recommendation is just overinterpretation.

(Sidney Lins) #64

I am wondering why not consistency examples in lowercase or camelCase. Other vendors probably looked at those consistency examples and realized that all they need is exactly “consistency”, even although it was not a recommendation (till now).

(Sidney Lins) #65

Furthermore, if PHP-FIG would decide to make a recommendation about this in some moment, it is easy to see what would be the more consistent choice they would pick.

(Alexander Makarov) #66

Here’s preliminary decision:

Not set in stone yet.

(Mehdi Achour) #67

If we’re going with yiisoft, I’d rather use YiiSoft if that’s okay with you.

(Softark) #68

Doesn’t it require the package names to be yii-soft/xxx?

(Mehdi Achour) #69

True that :smirk:


They didn’t explained. Maybe there was not reason (they flipped a coin) or reason is no longer valid.

Why Yiisoft/DI and Yiisoft/Db/MySQL instead of Yiisoft/Di and Yiisoft/Db/Mysql?

(Alexander Makarov) #71

Because it makes sense not to lowercase in some cases such as MySQL.


For me, it does not make sense at all. It just adds another weird rule which is hard to follow. Now you need to think twice what case you should use for this word in a namespace (Is it acronym? Or maybe just weird variation like MySQL or SQLite)? It is all much simpler with strict pascal/camel case, when the case of words is ignored and uppercase letters are used only to indicate word separators. It is also consistent with convention used so far for class names (MysqlMutex instead of MySQLMutex)

(Alexander Makarov) #73

After some practical application I tend to agree.