Class Name Requirements for Joomla's Script File

For anyone new to Joomla development, learning Joomla's conventions has its learning curve. This tutorial will cover naming Joomla's script file class. Let's get started.

First off, using the script file is completely optional. But, if you do use it, the class has to be named in a very specific way or else it won't get used.

Here's how to name a Joomla script file class

(name-of-the-extension)InstallerScript

The name of the extension should exactly match whatever is in the name tag of your extension's main manifest. Then you add "InstallerScript" to end of it.

Currently, classes are case insensitive in PHP and in Joomla. That might change in the future, so I recommend exact matching the case. But, it's not a big deal if you don't, as you'll see below.

Example Joomla script file class name

class Com_OSMetaInstallerScript extends AbstractScript

The example is from our OSMeta extension, which manages SEO meta data. The "Com_OSMeta" with InstallerScript appended to the end. The "Com_OSMeta" comes from the osmeta.xml's <name> tag:

 name tag of joomla manifest file


About the author

Nick is the Director of Support at Joomlashack and you can find him in almost every area of the site, from answering support requests and account questions to creating tutorials and software.