Well, since your application is not a module yet, you could just store your classes under a root 'src' directory and then follow PSR-0 or PSR-4 structure. I would also strongly suggest to introduce a consistent vendor prefix namespace (which I kept myself from doing systematically and am now regretting it).
E.g. PSR-0: '/src/Prefix/Device/Entity.php' => 'Prefix\Device\Entity' PSR-4: '/src/Device/Entity.php' => 'Prefix\Device\Entity' with 'Prefix' => '/src' If you then want to move the classes inside a module, you only need to drop the 'src' folder in it and configure the autoloader accordingly. While a lot of people will argue against it, I personally consider PSR-4 very well suited for ZF2 modules, since these are already contained in a directory named after their namespace. The only case where PSR-4 is not applicable is any library with more than one root namespace and no vendor prefix, which is quite rare anyway. E.g. PSR-0: '/modules/Prefix/ModuleA/src/Prefix/ModuleA/Module.php' => 'Prefix\ModuleA\Module' '/modules/Prefix/ModuleB/src/Prefix/ModuleB/Module.php' => 'Prefix\ModuleB\Module' PSR-4: '/modules/Prefix/ModuleA/src/Module.php' => 'Prefix\ModuleA\Module' with 'Prefix\ModuleA' => '/modules/Prefix/ModuleA/src' '/modules/Prefix/ModuleB/src/Module.php' => 'Prefix\ModuleA\Module' with 'Prefix\ModuleB' => '/modules/Prefix/ModuleB/src' Bear in mind that to have the ModuleManager properly load modules with such structure without the composer autoloader in place (which I have given for granted so far), you will still need the Module.php file inside each root module directory (that being 'src' parent), with just an 'include' pointing at the PSR compliant 'Module' class file. Cheers. Stefano Torresi Web Developer 2014-03-04 20:17 GMT+01:00 dennis-fedco <dmatve...@fedco-usa.com>: > Thanks, well that's better. > > I was going by ZF2 Module Structure ( > http://framework.zend.com/manual/2.2/en/modules/zend.mvc.intro.html > <http://framework.zend.com/manual/2.2/en/modules/zend.mvc.intro.html> .) > > Right now, other developers will hate me for having to refer to my class > like this: > "./module/Device/src/Device/Entity/Device.php" > > 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. > > > > -- > View this message in context: > http://zend-framework-community.634137.n4.nabble.com/Refactoring-towards-ZF2-subfolders-tp4661773p4661776.html > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- > List: fw-general@lists.zend.com > Info: http://framework.zend.com/archives > Unsubscribe: fw-general-unsubscr...@lists.zend.com > > >