Mura plugins are distributed as "
.zip" files. However, the
.zip archive itself contains the underlying files which comprise the plugin. In this section, we'll cover the anatomy of a Mura plugin, and the directories and files Mura requires in order to function properly.
When you begin creating a plugin, all of your plugin's directories and files must be packaged together under a common directory, and will ultimately be deployed under Mura as:
Be careful when naming your plugin's containing directory, as some operating systems will not accept special characters in the name. This is also important, because Mura will automatically create a CFML Application variable using "
this.mappings" to your plugin using the value of your directory name.
A basic directory structure of a Mura plugin is detailed below, and assumes all listed directories/files are located under
|Directory or File||Req/Opt||Description|
|/plugin/||Req||This directory is required, and contains configuration files required for plugin registration and deployment.|
|/plugin/config.xml.cfm||Req||Technically, this is the only required file, and contains the configuration settings and data required for your plugin.|
|/plugin/plugin.cfc||Opt||If this file exists, Mura will attempt to invoke specific methods during various phases of the plugin deployment, update, and/or deletion lifecycles. This allows developers to do things such as create custom database tables, connect to your custom API for authentication, and more.|
|/plugin/config.cfm||Opt||This file is completely optional, and merely contains some plugin configuration variables to be included in your application, if desired.|
|index.cfm||Opt||While this file is technically optional, it is highly recommended you include it. When an administrator navigates to your plugin via the back-end administration area, this is the file that will be rendered. So, if it doesn't exist, administrators will be presented with an error.|
|license.txt||Opt||If this file exists, the content will be used as an End Users License Agreement (EULA). When an administrator deploys the plugin, they will be presented with the EULA, and have to "accept" the terms before continuing to install and deploy the plugin.|
|/content_types/||Opt||If this directory exists, Mura will automatically and discover any custom content types found within it, and register them accordingly to any sites the plugin has been enabled for. See the Mura Content Types section for more information.|
|/modules/||Opt||If this directory exists, Mura will automatically discover any modules found within it, and register them accordingly to any sites the plugin has been enabled for. See the Mura Modules section for more information.|
Note: By default, Mura does not automatically scan for a "model" directory within plugins. This is intentional to avoid any collisions, as your plugin may have its own bean factory which scans for this directory as well.
The files outlined above represent a very basic plugin. Your plugin may contain many more directories and files than those listed here. Be sure to review the links for each file noted above for more details on their importance, and why may wish to include them in your own plugin.
Outside of the required and recommended directories and files, your plugin can be a completely separate, and independent application. If your application will merely be a portal of some kind, then maybe all you'll need is the "
index.cfm" file and "
However, in most cases, you're going to want to include some functionality to either add to, or even replace, Mura's business logic. As such, you'll want to do things such as register a custom event handler, so you can also register a custom "
model" directory, and more. Be sure to review The Plugin's "config.xml.cfm" File section for more details.