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:

  1. Start Line
  2. Root Element
  3. Metadata
  4. Namespace
  5. Front-end Files
  6. Media Files
  7. Administration Section (Menu Links, Submenus and Backend Files)
  8. Configuration
  9. SQL: Install, Uninstall, Update
  10. Script File
  11. 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:

<extension></extension>

Attributes

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

3. Metadata

The following elements can be used to insert metadata.

<name></name>
<author></author>
<creationDate></creationDate>
<copyright></copyright>
<license></license>
<authorEmail></authorEmail>
<authorUrl></authorUrl>
<version></version>
<description></description>

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.

4. Namespace

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.

<namespace path="src/">TechFry\Component\Planets</namespace>

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.

<files folder="site">
<folder>forms</folder>
<folder>src</folder>
<folder>tmpl</folder>
<filename>example.php</filename>
</files>

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,

<filename plugin="example">example.php</filename>

6. Media Files

Extensions should store the assets (JS, CSS, images) in the media folder.

<media folder="media" destination="com_example">
<filename>com_example_logo.png</filename>
<folder>css</folder>
<folder>js</folder>
</media>

7. Administration Section

This is applicable to only components. This section includes menu links and back-end files.

<administration>
<menu link="index.php?option=com_planets">COM_PLANETS_MENU</menu>
<files folder="admin">
<filename>access.xml</filename>
<filename>config.xml</filename>
<folder>forms</folder>
<folder>language</folder>
<folder>services</folder>
<folder>sql</folder>
<folder>src</folder>
<folder>tmpl</folder>
</files>
</administration>

8. Configuration

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.

<install>
 <sql>
  <file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
 </sql>
</install>

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.

<update>
 <schemas>
  <schemapath type="mysql">sql/updates/mysql</schemapath>
 </schemas>
</update>

10. Script File

An optional script file can be defined using a <scriptfile> element.

<scriptfile>script.php</scriptfile>