project directory tree/structure your favorite?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have been working on a rather large project.  And I have been
thinking about the structure of how I organize my project apps and
libraries.  It's intended as a framework type system where you can
place in parts and configure as needed, there are shared libraries for
authentication, and common code for validation and data management.

Presently the directory tree is like this:

-app 1 dir (maillist.php, mailedit.php, mailreport.php etc.)
-app 2 dir (libraryedit.php, library reports.php, etc.)
-app 3 dir
-config dir
-shared libraries dir (datetimelib, dblib, etc.)
-system apps dir (admin tools: useredit.php, groupedit.php, etc.)

It works OK, but I go horizontally to include a library:
require_once "../libraries/somelib.php";

Having used Dokuwiki I've been pondering its always up structure,
where you have a shell doument at the root level of your project and
everything are in subfolders and you include included as needed into
the main (shell) app..

appshell.php  (everything happens here)
- libraries
- config
- modules (apps)
- - admin module
- - module 1 (includes for app 1)
- - module 2
- - module 3

Have you tried this sort of structure?
What do you guys use/prefer?
Any tips that makes management easier?


Re: project directory tree/structure your favorite? wrote:
Quoted text here. Click to load it

Well the structure depends on the project requirements. On my own  
framework i use following structure:

/etc            - misc files (readable)
/img            - images (readable)
/lib             - libaries (readable)
/sys            - php files, classes and config files
/tpl/designname        - template files of a design
/var            - files created by the system/application
index.php        - main file (readable)

(readable) mean that the web user can access these diretories/files.

The system and every application has their own folder in every of these  

That way the system files and files of every application have their own  
storage and are completly separated.


Re: project directory tree/structure your favorite?

Quoted text here. Click to load it

So, do the programss all run through index.php, or are they called

Re: project directory tree/structure your favorite? wrote:
Quoted text here. Click to load it

Every request goes through the index.php. The index.php calls a router  
object that acts like the Zend_Controller_Router_Rewrite extraction the  
information of the request and calling the requested application classes  
and scripts.

So the scope of the script is always on the same level as the index.php.  
A include statement for a libary will be the same for every application.


Re: project directory tree/structure your favorite?

Greetings, Joe Scylla.
In reply to Your message dated Tuesday, December 11, 2007, 10:50:49,

Quoted text here. Click to load it

For sure.

I prefer to move system files away from the direct access of webbrowsers.
Even I'm dealing with Apache server all the time and can control folder and
file access from .htaccess files, I've found better to not place anything You
do not want to be accessed from the web in the web directory.
So, typically my web projects looks like:

~/data/ <- project code files, templates and such
~/doc/ <- project documentation and notes, not intended for web access
~/htdocs/ <- all the things that should be accessed from the web
That includes index.php, all static content like images/js/css etc.
~/inc/ <- 3rd party library includes (Like PEAR, Smarty, my own tools etc.)
~/log/ <- project site logs and project logs (if any)
~/tmp/sessions <- temp files and session files
sessions in the separate folder to not cross with temp files

Of course, working on my home system I have my tools in separate directory
accessed by include_path.

This changes if I'm working on standalone scripts, but not much.


Site Timeline