SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do you like your Directory Structure for Applications?

    Im not sure on how to go about this, but Id like to see what other people to do get the most practical idea when organizing a large system.

    How might you do it?

    /
    __/controls
    ____db.php
    ____config.php
    ____session.php
    __/functions
    ____process.forms.php
    ____validation.php
    ____process.edit.php
    __/templates
    ____header.tpl
    ____footer.tpl
    __/includes
    ____required.php
    ____other.php
    __index.php
    __login.php

    Really is there a standard way of doing this?

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,194
    Mentioned
    17 Post(s)
    Tagged
    4 Thread(s)
    • site
      • trunk (private root)
        • httpdocs (public root)
          • index.php (driver/entry point)
          • include
            • css
            • flash
            • js
          • img
        • include
          • php
            • init.php
            • config.php
            • app
              • controller
              • model
              • view
            • lib
              • active_record
              • view
              • controller
              • cookie
              • form
              • pagination
              • client
              • connection
              • session
              • ...

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is an account's home directory:
    • bin (executables and command line scripts, especially for cron jobs)
    • build (build scripts)
    • cache
    • configs
    • docs (generated API docs of the lib/ directories)
    • data (file-based data)
    • lib (3rd-party libraries)
    • site
      • controllers
      • lib (app/site-specific libraries)
      • public (public)
        • index.php (activates bootstrap.php)
      • test
      • views
        • screen
        • mobile
        • pie
        • iphone
      • bootstrap.php
    • resources (static server-side content)
      • fonts

    If there are multiple sites, then there will be copies of site's directory structure.

    Unlike a software distribution's directory structure, where you have separate src/ and bin/ directories, this doesn't allow for that, so the post-commit scripts for the versioning systems just make a copy of the entire directory and run the necessary transformation routines (jsmin on JS files, etc.).

  5. #5
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool!
    Ive seen people do it the Symfony way a lot

  6. #6
    SitePoint Guru risoknop's Avatar
    Join Date
    Feb 2008
    Location
    end($world)
    Posts
    834
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    MyZendProject
        application
            config
                application.ini
            layouts
                scripts
                    default.phtml
            modules
                default
                    controllers
                        ErrorController.php
                        IndexController.php
                    forms
                    models
                    views
                        helpers
                        scripts
                            error
                                error.phtml
                            index
                                index.phtml
            bootstrap.php
        library
            My
                Controller
                    Action
                        Helper
                Decorator
                View
                    Helper
            Zend
        public
            css
            fonts
                arial.ttf
            images
                captcha
            js
            .htaccess
            index.php
    That is my default diretory structure I use for the Zend Framework.

    EDIT: I have forgot about few folders.
    Last edited by risoknop; May 9, 2009 at 05:42.

  7. #7
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  8. #8
    Spirit Coder allspiritseve's Avatar
    Join Date
    Dec 2002
    Location
    Ann Arbor, MI (USA)
    Posts
    648
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by kyberfabrikken View Post
    That was very helpful.

    Has anyone molded their directory structure around Domain Driven Design? I would be curious to see how things changed. For instance, in a "conventional modular" directory structure, would each module have it's own domain folder, or would the entire app have one domain folder? Also, where does the persistence layer belong?

    I did come across this post: http://blog.fedecarg.com/2009/03/22/...driven-design/ which had a DDD directory structure, but I didn't think the DAOs belonged in the domain, and I may be wrong on this but I think that external libraries are not supposed to be in the infrastructure layer?

  9. #9
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Currently I'm still developing my structure but it looks like this at the moment: (Items in brackets are placeholders]
    Code:
    example.com
    |   dev            # Sets the application into development mode
    |   license        # Probably BSD License in most cases
    |   manifest.xml   # Holds checksums for all default files
    |
    +---public
    |   |   index.php
    |   |   web.config
    |   |
    |   \---store
    |       +---css
    |       +---img
    |       \---js
    |
    \---system
        +---application
        |   |   bootstrap.php
        |   |
        |   +---config
        |   |   |   global.xml
        |   |   |
        |   |   \---[module]
        |   |           global.xml
        |   |           [page].xml
        |   |
        |   \---[module]
        |       +---control
        |       +---model
        |       \---view
        |           +---master
        |           \---[page]
        |
        +---library
        |   \---[lib_vendor]
        |
        \---temp
            +---cache
            |   +---config
            |   \---view
            |       \---[module]
            |
            \---session
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •