Joomla Manifest Files for Extensions
All Joomla extensions have XML manifest files (<extension_name>.xml). This file is located in the root directory of the installation package. It include general installation information and parameters for the extension.
The manifest file contains:
- Start Line
- Root Element
- Front-end Files
- Media Files
- Administration Section (Menu Links, Submenus and Backend Files)
- SQL: Install, Uninstall, Update
- Script File
- Update Servers
1. Start Line
All XML files start with:
<?xml version="1.0" encoding="utf-8"?>
2. Root Element
This starting and closing tags for all extensions are:
- type (type of extension - module, plugin, component, language, file, package, library, template)
- method (install or upgrade)
- group (applicable only for plugins)
- client (applicable only for modules) - site or administrator
<extension type="plugin" group="content" method="upgrade">
The group attribute is required for plugins as there are several types of plugins. The upgrade method is important. If you do not include this, then every time you install an upgrade version of the extension, the uninstall script will run and it will delete your existing data.
The following elements can be used to insert metadata.
After adding root element and its attributes, add the metadata information. The version tag is important as each time you release a new version of your extension you should adjust this version number. You should use a three digit version number separated by full stops. The description tag is the text that the user will see when they install or upgrade the extension.
Specify the namespace to be used for autoloading the extension. The given namespace will autoload to the root directory of your extension by default however you can optionally add a "path" attribute to the namespace element to specify a path within your extensions root directory.
5. Front-end Files
The next part of the manifest is to include all files and folders to copy to the front-end directory. It is placed in the <files> element.
You can use the folder tag to include all the files and subfolders within a folder. You can use the optional folder attribute to specify a directory in the ZIP package to copy from.
For plugins, the raw name of the plugin should be placed in the plugin attribute on the <filename> element that points to the file containing the plugin's class. For example,
6. Media Files
Extensions should store the assets (JS, CSS, images) in the media folder.
<media folder="media" destination="com_example">
7. Administration Section
This is applicable to only components. This section includes menu links and back-end files.
The <config> element describes the configuration options for the extension (except component type, which do not support this). These options can also be defined in a separate file named config.xml.
Each fieldset must contain one or more <field> elements.
9. Database SQL Files
Components generally have one or more database tables to store data. When you install your component, you need to run some SQL command to create the table, so the <install> tag tells Joomla where this file is.
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
When someone uninstalls your component, you will need to run some clean up SQL commands that delete the tables used by your component and remove all traces. The <uninstall> SQL files allow you to do that.
The <update> tag allows you to provide a series of SQL files to update the current schema.
10. Script File
An optional script file can be defined using a <scriptfile> element.