I have an application where all its classes are in folder called ./class.
So, for example, I would have ./class/Device.php to host my class, because:
1) class folder holds my application's classes. It is good to separate my classes from everything else
2) name of my class is there to differentiate in case I have more than one class
In a move towards ZF2, I moved the class elsewhere. Specifically, here:
The path seems awfully long. I want to check if I am doing it right.
My understanding is that:
1) module dir is to store any generic module, so it is 'needed'
2) DeviceModule is the name of *my* module, and it is there to differentiate from any other modules I may want to create. So this is also 'needed'.
3) src is there to separate "source code" from "other module stuff" like HTML, tests, templates.
4) DeviceModule is there for namespace, in case I have more than one namespace in my module.
5) Entity folder is there to store my "entity" classes
6) The name of my class
7) oh wait, there is no 7
Is there indeed the need for all these sub=folders?
Right now, other developers will hate me for having to refer to my class like this:
because this entire 5-level-deep directory structure is set up for one class (at the moment). Even when I have 10 classes there, the depths will remain the same.
I could instead do something like "./module/Device/src/Device/Device.php" to aid separation without too much depths, or even "./module/Device/Device/Device.php", but that's moving away from ZF2 structure and I want to go towards it.
I got a little lost.
* why are there similar but different PSRs concerning paths and namespaces?
* what sis a "vendor specific prefix"? In my case I am writing the app, so there is no 3rd party vendor.
* why is your 'Prefix' equals '/src'? I thought a 'Prefix' is a descriptive name for a 3rd party module like '/vendor/ZfcUser/..'
* What is a Prefix? Is that a namespace? no... what's it for?
So far I am thinking that I will put my classes into `module/Device` folder, but I am so confused right now I don't know what to do.. I might just leave it in 'module/Device/src/Device/Entity' like I have now, because when it will come for porting to ZF2, I will have my structure already in place.
I am not having a clear understanding on PSR-0, PSR-4 and which one to use and why.