This is step-by-step actionable guide on how to create a Joomla component from scratch. As an example, we will be creating Joomla component Planets. This component will contain information about the planets.

Step 1: Directory Setup and Manifest Files

The main directory of the component will be com_planet. In this, you need two folders - admin and site. You also need manifest file - planet.xml. Keep changing the manifest file as develop your extension and add more files and features.

  • admin
  • site
  • planet.xml

Step 2: Language Files

Create language files for both admin and site part.

  • admin/language/en-GB/en-GB.com_planet.ini
  • admin/language/en-GB/en-GB.com_planet.sys.ini
  • site/language/en-GB/en-GB.com_planet.ini

Step 3: Database Design

First, you need to plan what database tables are required for the component. Create install, uninstall and upgrade (upgrade file will be empty at present) SQL files.

  • admin/sql/install.mysql.utf8.sql
  • admin/sql/uninstall.mysql.utf8.sql
  • admin/sql/updates/mysql/0.0.1.sql

Step 4: Basic Back-end: Controllers, Views & Models

Create main entry file for the admin part, main controller file (define default view here), and corresponding views and models.

  • admin/planet.php
  • admin/controller.php
  • admin/views/planets/view.html.php
  • admin/views/planets/tmpl/default.php
  • admin/models/planets.php

Step 5: Data For Back-end List

Get the following in view file (view.html.php) from the corresponding model file (planets.php), and display in the corresponding layout file (default.php)

Add the page title and toolbar to the view file.

Step 6: Setup Back-end Add and Edit Forms: Subcontrollers

Create sub-controller files

  • admin/controllers/planet.php

Get the following in view file (view.html.php) from the corresponding model file (planet.php), and display in the corresponding layout file (default.php)

Add the page title and toolbar to the view file.

Step 7: Advanced Component Development