How to Create Plugin for Joomla 3.x

Plugins are powerful way of extending the functionality of the Joomla. Plugins provide functions which are associated with trigger events. Joomla has a set of core plugin events. Plugin code is executed when certain events are triggered.

Events or plugins are divided into groups.

A basic Joomla plugin contain following files:

  • XML Installation File
  • PHP Code File

List of Event Plugins


  1. onUserAuthenticate


  1. onInit
  2. onDisplay
  3. onCheckAnswer


  1. onContentPrepare
  2. onContentAfterTitle
  3. onContentBeforeDisplay
  4. onContentAfterDisplay
  5. onContentBeforeSave
  6. onContentAfterSave
  7. onContentPrepareForm
  8. onContentPrepareData
  9. onContentBeforeDelete
  10. onContentAfterDelete
  11. onContentChangeState
  12. onContentSearch
  13. onContentSearchAreas


  1. onInit
  2. onSave
  3. onSetContent
  4. onDisplay
  5. onGetContent
  6. onGetInsertMethod


  1. onExtensionAfterInstall
  2. onExtensionAfterUninstall
  3. onExtensionAfterUpdate
  4. onExtensionBeforeSave
  5. onExtensionAfterSave


  1. onFinderCategoryChangeState
  2. onFinderChangeState
  3. onFinderAfterDelete
  4. onFinderAfterDelete
  5. onFinderBeforeSave
  6. onFinderAfterSave

Quick Icons

  1. onGetIcons


  1. onAfterInitialise
  2. onAfterRoute
  3. onAfterDispatch
  4. onAfterRender
  5. onBeforeRender
  6. onBeforeCompileHead
  7. onSearch
  8. onSearchAreas
  9. onGetWebServices


  1. onUserAuthorisation
  2. onUserAuthorisationFailure
  3. onUserBeforeSave
  4. onUserAfterSave
  5. onUserBeforeDelete
  6. onUserAfterDelete
  7. onUserLogin
  8. onUserLoginFailure
  9. onUserAfterLogin
  10. onUserLogout
  11. onUserBeforeSaveGroup
  12. onUserAfterSaveGroup
  13. onUserBeforeDeleteGroup
  14. onUserAfterDeleteGroup

How To Start

To get started with plugin development, first you need to decide what problem you are trying to solve or what functionality you are trying to implement. Check the Joomla Extension Directory (JED) that a solution to this problem does not already exist.

The next step is to come up with a unique name for this extension. The first part of the name (plg) indicates that this is a plugin extension. Second part identifies what type of plugin this is. Third part is the unique name. For example, plg_content_uniquename

XML Installation File

This file is similar to manifest files for other extensions. You have to add the group entry in the <extension> tag and the extended information in the <filename> tag. This information tells Joomla! into which folder to copy the file and to which group the plugin should be added.

PHP Code File

In Joomla, all plugins are subclass of JPlugin, a base class that implements the basic properties of plugins. In methods, following properties are available:

  • $this->params (parameters set in the administrator)
  • $this->_name (name of the plugin)
  • $this->_type (group of the plugin)
  • $this->db (db object)
  • $this->app (application object)
// no direct access
defined( '_JEXEC' ) or die;

class Plg<PluginGroup><PluginName> extends JPlugin
* Load the language file on instantiation.
protected $autoloadLanguage = true;

* Plugin method with the same name as the event will be called automatically.
public function <EventName>()
* Plugin code goes here.
* You can access database and application objects and parameters via $this->db,
* $this->app and $this->params respectively
return true;

As with all extensions in Joomla, you can install plugins as a .zip file.