Before we get into the directory structure we will be using for this project, I wanted to let you know I have decided on a project name. The basic idea for the application I’m building is to create a hierarchical storage system, hence the name:
UDID – User Designed/Defined Information Directory
(Of course it is an acronym, you expected something else?)
There is a legitimate reason for naming the project before even setting up the development area. The project will be stored under the ‘Udid’ directory, and all of the class names will reflect the position of the file within the project’s directory structure. I will explain more about this when we get into writing classes and actually coding, but if you would like more information about this type of setup you can read about the Zend Framework naming conventions for classes.
OK now we have a name and it’s time to setup the directory structure. First we create the ‘udid’ directory and beneath that we create a ‘project’ directory; such as:
udid
|-> project
The ‘project’ directory will hold all the files directly associated to the project. The reason I have created this directory and did not just store the project code within ‘udid’, is because we will be using some third party applications to help with development and I do not want that third party code to actually be associated to the project code. For example we will be using Simple Test for unit testing. We will be placing Simple Test within ‘udid’, but not within ‘project’. So now we have:
udid
|-> project
|-> simpletest
As you know we will be using SVN to store the code, so we are going to be using what I learned as the traditional setup for a SVN project, not because it is the traditional way, but because I’ve used it before and it has worked well for me. This structure is:
project
|-> branches
|-> tags
|-> trunk
These three directories have very specific purposes:
- branches: Experimental development branches. Branches are used when you decide to make some dramatic changes to the code base, but your not really sure how it is going to work out, so you do not want to code within the ‘trunk’ but you may want to merge the code within the trunk at a later time.
- tags: This directory is used to store the project at certain milestones, i.e. version releases.
- trunk: Main development thread
So this is what our directory structure looks like so far:
udid
|
|-> project
| |-> branches
| |-> tags
| |-> trunk
|
|-> simpletest
OK, for the rest of this post we will be working in the ‘trunk’ to setup the actual directory structure for the project code…
At some point a long time ago I got into the habit of creating a subdomain for each new project I work on, this I find convenient because the subdomain’s document root is its own and is not cluttered with other directories, files, etc. As an added bonus the document root can be anywhere on the system. Consequently the directories below ‘trunk’ look like this:
trunk
|-> public_html
|-> Udid
Obviously ‘public_html’ is the document root, and ‘Udid’ will store all the back-end PHP code. Notice the PHP code will be stored outside the document root (where a browser is unable to access it directly). I prefer to setup my projects this way as an added security measure. For more information about the security aspects of this; check out Chris Shiflett’s article: Security Corner: Secure Design (be sure to read the comments).
For now ‘public_html’ will remain empty and ‘Udid’ will hold the directory structure for the application. So this will be the development directory structure we’ll be using…
udid
|
|-> project
| |-> branches
| |-> tags
| |-> trunk
| |-> public_html
| |-> Udid
|
|-> simpletest
Please note, I have still not imported the project into SVN, you can actually do the import as soon as you have the first directory created, but I like to wait until I have the basic structure of the application set, which brings us to the topic of the next post. What is the directory structure of the application itself; or what directories will be created below Udid: ‘udid->project->trunk->Udid’?
I will post this structure in the next few days, and import the project into SVN, so we can finally get down to some code! Thanks for reading.



PDF













