Uppercase or lowercase folder-name and namespace

materix
Member | 66
+
0
-

I have noticed that the first-letter of “app”-folder is often lowercase, while the sub-folders such as “Presenters” and “Model” have first-letter uppercase.

For instance in the “nette/web-project”-project, the folder for the Router is: “app/Router/”.

While the namespace is all uppercase, e.g. “namespace App\Router”.

https://github.com/…rFactory.php#L5

What is the reason for this? Should not the namespace be “app\Router”?

Marek Bartoš
Nette Blogger | 1173
+
+2
-

It's up to you, defaults are just a generally used convention
https://github.com/…omposer.json#…

Lumeriol
Generous Backer | 58
+
+1
-

The rules about folders and namespaces are determined by the PSR-4 (autoloader), which is defined in the Composer.json file in the root folder. PSRs are general rules for writing code in PHP, but they are all optional.

You can see more about them see this site https://www.php-fig.org/psr/psr-4/.

mystik
Member | 291
+
+1
-

Convention is that app source codes no matter what namespace you use (App, MyApp, Something,… ).

And it is convetion to have namespaces with first uppercase.