views:

33

answers:

1

When using the normal architecture (I guess it's called controller-based architecture), zend recommends the following folder structure (taken from here):

  <project name>/
      application/
          configs/
              application.ini
          controllers/
              helpers/
          forms/
          layouts/
              filters/
              helpers/
              scripts/
          models/
          modules/
          services/
          views/
              filters/
              helpers/
              scripts/
          Bootstrap.php
      data/
          cache/
          indexes/
          locales/
          logs/
          sessions/
          uploads/
      docs/
      library/
      public/
          css/
          images/
          js/
          .htaccess
          index.php
      scripts/
          jobs/
          build/
      temp/
      tests/

Now for projects that use a module-based architecture, not the default controller-based architecture, I can't find a recommended folder structure.

  • I know that there will be a modules folder and each module within it will have its own sub folders (controllers, views, models).
  • But I've seen a tutorial create only controllers and views (no models) and bunch up all the models in the main (application) model folder. Strange!
  • Also since it's module based, shouldn't the main application content also be moved into a module of its own? And if they were to be moved into a separate module, would there be a need for folders (controllers, views, models) in the application-level itself?
+2  A: 

It's really up to you. Personally I keep module-specific models in the respective module's models directory, but 'general' application models at the application level. The error controller, for example, you'd keep in application/controllers.

Tim Fountain
I see. So to verify what I understood. Even with module-based architecture, if I were to move the main application itself to a separate module ("default"), there's only so much I can move from the main app to that default module. I can move all controllers (including IndexController), except the ErrorController since that should stay application-wide. 2) I guess this answers the other question: should I delete the application models/views/controllers folders? The answer would be no, since even with module-based architecture, some parts still have to stay in the main application. Correct?
jblue
I'd agree with all of that, 'have' is a strong word though - Some people do use a 'default' module, and I'm sure it's possible to use a module-specific error controller if you wanted to; ZF is flexible.
Tim Fountain