PHP Joomla! 6 Joomla! 5 Joomla! 3 (Legacy) Component Basic

Read Component Parameters Inside the Component

Retrieves active component parameters merged with current menu item overrides using $app->getParams().

Updated on 24 November 2026 27 copies 119 views
components/com_example/src/View/Items/HtmlView.php
<?php

declare(strict_types=1);

use Joomla\CMS\Application\SiteApplication;
use Joomla\CMS\Factory;

$app = Factory::getApplication();

if ($app instanceof SiteApplication) {
    $componentParams = $app->getParams('com_content');
    $param           = (string) $componentParams->get('paramName', 'defaultValue');
}
Merges component defaults with active site menu item overrides automatically.
components/com_example/src/View/Items/HtmlView.php
<?php
$app             = JFactory::getApplication('site');
$componentParams = $app->getParams('com_content');
$param           = $componentParams->get('paramName', 'defaultValue');
Legacy Joomla 3 snippet calling JFactory::getApplication('site').

Technical explanation and best practices

On the Joomla frontend, $app->getParams() automatically merges global component options with any overrides configured on the active menu item.

In the Administrator application, use ComponentHelper::getParams() directly instead.

Direct Engineering

Have a Joomla project or technical challenge in mind?

From architectural diagnosis to production deployment, directly with the engineer.