When you unpack Cake on your server you will find four folders - app
, cake
, tmp
, and vendors
. The cake
folder is where the core libraries for Cake lay and you generally won't ever need to touch them unless you want to do some customisation to Cake itself.
It wasn't always this way - before the 0.10.0 release of CakePHP everything was in one folder called Cake. This proved to have several problems.
If you wanted to have more than one web app you had to download and install Cake twice and duplicate the core libraries, this was both a waste of space and violated the DRY philosophy that CakePHP tries to adhere to.
When a new version of CakePHP was released you had to be very careful not to overwrite what was in your app directory with the defaults from the new version.
The app
folder is where your application specific folders and files will go. The separation between the Cake folder with the core libraries and the app folder make it possible for you to have many app folders sharing a single set of Cake libraries. This also makes it easy to update CakePHP: you just download the latest version of Cake and overwrite your current core libraries; No need to worry about overwriting something you wrote for your app.
The tmp
directory is used for various Cake operations, such as baking (automatically creating new php files), caching, and logging.
You can use the vendors
directory to keep third-party libraries in. You'll learn more about vendors later.
The following list shows the major folders and their basic purposes:
cake
(the root directory)
app
(here's where your application logic will go)
config
(application specific configs are here: ACL, core, database connection, routes, paths, and tags)
controllers
(controllers go here)
components
(components, classes that aid you with controller logic go here)
index.php
(There are three of these in cake: it makes it easy for you to deploy your Cake app in many different ways)
models
(models go here)
plugins
(plugins - or third party apps - go here)
views
(view related files go here)
elements
(small repeated layout items go here)
errors
(error pages go here)
helpers
(your homegrown helpers go here)
layouts
(page layouts go here)
pages
(static content managed by PagesController go here)
webroot
(use this directory as your webroot, and stick your public files in here)
css
files
img
js
cake
(this is where the libraries are placed: its best not to touch)
index.php
tmp
(used for logs, baking, etc.)
vendors
(stick your third party libraries here)