How Joomla MVC Component Works

Component is a type of Joomla extension (like Modules and Plugins). Unlike modules and plugins, components have two main parts - site and administrator. The site part is visible to visitors (frontend access). The administrator part is interface for managing extension from the backend.

Joomla! components are developed using Model-View-Controller (MVC) pattern. In Joomla, models are used to manage the data.

1. Accessing Joomla! Component

You can either use direct URL of the component or a Menu item in order to navigate to the component.

Site Access

<joomla_path>/index.php?option=com_<component_name>
<joomla_path>/index.php?option=com_stars

Administrator Access

<joomla_path>/administrator/index.php?option=com_<component_name>
<joomla_path>/administrator/index.php?option=com_stars

2. Directory Structure

All the components are stored in the components folder of Joomla Installation. 

<joomla_path>/components/com_<component_name>/

A component contains following files within its directoryː

Component Root Directory

  • <component_name>.xml or stars.xml (Manifest File)
  • admin
  • site
  • api

Admin Directory

  • admin/forms
  • admin/services
  • admin/sql
    • /updates/mysql/1.0.0.sql
  • admin/src
    • /Controller
    • /Extension
    • /Helper
    • /Model
    • /Table
    • /View
  • admin/tmpl

Site Directory

  • site/src
    • /Controller
    • /Model
    • /View
  • site/tmpl

3. Component Workflow (MVC)