Directories

MogulMVC is organized between two different directories. The backend directory for all your PHP code, and the frontend directory for CSS, JavaScript, images, and any other public static files.

Within the backend and frontend directories you will find a directory called framework. Unless you know what you're doing you should not alter any content within this directory.

Instead we will be exploring the other directories in the backend and frontend directories. We will start with the backend directory.

Backend

The backend directory is organized as follows.

/cache/
	/command/
	/config/
	/controller/
		/action/
		/api/
	/framework/ ← Don't alter anything in here
	/lib/
		/core/
		/vendor/
	/model/
		/vo/
	/view/
		/template/

Backend Cache - cache


Nothing should be placed in this directory. It is a directory used by MogulMVC to store cached HTML pages when using MCache.

Backend Command - command


This directory is for storing CRON jobs as well as commands for building and migrating databases. Any PHP command you want to run from the command line goes here.

Backend Configuration - config


Used to store configuration files used in the running of MogulMVC.
See PHP Configuration for more detail about how to use these files.

Backend Controller - controller


The controller directory is where you put all your controllers. There are also two sub type of controller listed below.
See PHP Controllers for more detail about how to create controllers as well as actions and apis.

Action - action

Your form and AJAX actions go in this directory.

API - api

Your APIs go in this directory.

Backend Libraries - lib


All your PHP libraries should go in this directory.

Vendor - vendor

Vendor PHP libraries go here. These are libraries not written by you.

Core - core

Core PHP libraries go here. These are libraries written by you.

Backend Model - model


Models are used to store functions for quick database access. MogulMVC offers two types of models, but both types go within this directory.
To learn to create and use models see PHP Models.

VO - vo

If you want to use value objects with your models you can store vos here.
Value objects allow for easier creation of database objects with certain values preset such as created and updated.
To learn to create and use vos see PHP Models.

Backend View - view


Views are used to render PHP variables to an HTML page.
To learn to create and use views see PHP Views.

Template - template

Templates are reusable UI elements that can be passed data and used in conjunction with views.
To learn to create and use templates see PHP Views.

Frontend

MogulMVC's frontend directory is loosely based on the HTML5 Boilerplate project.

The frontend application directory is organized as follows.

/application/
	/cache/
	/css/
		/core/
		/vendor/
	/framework/ ← Don't alter anything in here
	/img/
	/js/
		/core/
		/vendor/
	/misc/
	/upload/
		/.htaccess

Frontend Cache - cache


Nothing should be placed in this directory. It is a directory used by MogulMVC to store minified CSS and JavaScript when in production mode.

Frontend CSS - css


The frontend css directory is divided into two directory, just like the backend lib and frontend js directories. These directories are core and vendor.

Vendor - vendor

A place to put css files not written by you. For example, Twitter Bootstrap or Flat UI would be placed here as they are provided by third party vendors.

Core - core

A place to put css files that are written by you. The css files that are needed for your site and were not provided by third party vendors.

Frontend Images - img


This is where you put all images relating to your project.

Frontend JavaScript - js


The frontend js directory is divided into two directory, just like the backend lib and frontend css directories. These directories are core and vendor.

Vendor - vendor

A place to put js files not written by you. For example, Twitter Boostrap or jQuery Mobile would be placed here as they are provided by third party vendors. jQuery and jQuery UI are provided by the core framework and only should be placed here if you need to use a different version.

Core - core

A place to put js files that are written by you. The js files that are needed for your site and were not provided by third party vendors.

Frontend Miscellaneous - misc


A place to put any file that does not fall into other categories. For example, videos, PDFs, or zip files.

Frontend Upload - upload


This is where uploaded files should be uploaded to. This directory contains a .htaccess file which disallows the execution of web scripts. This means that if a user uploads a PHP file then tries to access it the script will be served back as a file rather than be executed as a script.