System Plugins

Official Documentation:

A system plugin is not only useful for a wide variety of site tasks, but is also a good intro to the lifecycle. Take note of the naming coventions plg group name written camel case for the class and snake case for the the internal plugin name.


File Location: /plugins/system/example/example.xml

<?xml version="1.0" encoding="utf-8"?>
<extension version="3.8" type="plugin" group="system">
  <creationDate>January 2018</creationDate>
  <description>An example system plugin</description>
    <filename plugin="example">example.php</filename>

Entry File

File Location: /plugins/system/example/example.php

defined('_JEXEC') or die;

class plgSystemExample extends JPlugin
    public function onAfterInitialise()
        // Do something onAfterInitialise
        // eg. Manipulate the input prior to the router dealing with it

    public function onAfterRoute()
        // Do something onAfterRoute
        // eg. Test to see if this a certain component and if so run some script

    function onBeforeCompileHead()
        // Do something onBeforeCompileHead
        // eg. Manipulate something in the head tag

    public function onAfterRender()
        // Do something onAfterRender
        // eg. pull the html from the document buffer and do a string replace on something