2. Overview of the Cake File Layout

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.

  1. 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.

  2. 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: