PHP
Joomla! 6
Joomla! 5
Joomla! 3 (Legacy)
Plugin
Basic
Read Plugin Parameters Inside the Plugin
Reads XML configuration fields inside a CMSPlugin subclass using $this->params->get() with a safe fallback.
plugins/content/example/src/Extension/Example.php
<?php
declare(strict_types=1);
// Dentro de uma classe que estende Joomla\CMS\Plugin\CMSPlugin
$param = (string) $this->params->get('paramName', 'defaultValue');
Works natively inside modern Joomla 5 and 6 SubscriberInterface plugins.
plugins/content/example/src/Extension/Example.php
<?php
$param = $this->params->get('paramName', 'defaultValue');
Classic Joomla 3 plugin parameter access.
Technical explanation and best practices
Every plugin class extending CMSPlugin automatically has access to $this->params as a Joomla\Registry\Registry instance.
Always pass a default fallback value and cast to the expected scalar type for strict PHP 8.3+ compatibility.