CakePHP Files and Folder Structure

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 customization to Cake itself.

The app
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 you 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 folders structure and their basic purposes:

— root (the root directory)

— — app (here’s where your application logic will go)

— — — config (application specific configurations)

— — — controllers (controllers go here)

— — — — components

— — — index.php

— — — models (models go here)

— — — plugins (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 home-based helpers go here)

— — — — layouts (page layouts go here)

— — — — pages (static content managed by PagesController go here)

— — — webroot (this directory as your webroot, and stick your public files in here)

— — — — css

— — — — files

— — — — img

— — — — js

— — cake (this is where the libraries are placed: Note: it’s best not to touch)

— — index.php

— — tmp (used for logs, baking, etc.)

— — vendors (stick your third party libraries here)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>