API Guides
From Joomla! Documentation
This page contains an index to the set of Joomla API Guides. These guides aim to help you understand how to use these Joomla functions in your own Joomla extensions.
Each API guide includes sample code which you can copy and install in your own development environment. Generally these code samples are written to be included and installed as Joomla module, so if you're not familiar with Joomla module development you may find going through the short series Creating a Simple Module useful.
Around Joomla 3.8 the Joomla development team began changing the naming convention of Joomla classes to use namespaces, so that for example JFactory changed to Factory in the Joomla\CMS namespace. As you read existing Joomla code and documentation you may find the classes following either the new or the old naming standard. You can find the mapping between the two naming conventions in the libraries/classmap.php file in your Joomla instance.
- The base Application classes and their hierarchy and purposes is described in Understanding the Application classes
- Ajax handling within Joomla Components is described in JSON Responses with JResponseJson. Ajax can also be used within Joomla Modules and Plugins as described in Using Joomla Ajax Interface.
- Cache - how to use callback cache within your code.
- Categories Using the Categories and CategoryNode classes to access data relating to Joomla categories
- CSS can be added as described in Adding JavaScript and CSS to the page
- Database / JDatabase. There are two API guides, covering Selecting data using JDatabase and Inserting, Updating and Removing data using JDatabase
- Date/JDate is Joomla's Date class.
- Files and Folders. See How to use the filesystem package.
- Form / JForm. There is a Basic guide to using the Joomla Form API and incorporating forms within a Joomla component, and also a more Advanced form guide covering more advanced aspects of the APIs.
- FormField / JFormField. This class and related classes such as JFormFieldList which inherit from it are primarily useful for defining custom form fields, as described in Creating a custom form field type.
- Input / JInput Using the Input class to obtain the values of parameters in HTTP GET and POST requests
- JavaScript can be added as described in Adding JavaScript and CSS to the page
- Using Joomla Layouts is described in Sharing layouts across views or extensions with JLayout. The flexibility was increased in Joomla 3.2, as described in JLayout Improvements for Joomla!.
- Log / JLog Log messages (eg error messages, debug messages) to a log file, and optionally to the debug console
- Menu and Menuitems
- Nested Sets, which enable a tree hierarchy to be implemented in the database table, are used by Joomla menus, articles, categories, etc.
- Registry/JRegistry is a utility class which is very useful for handling PHP arrays, converting to JSON, etc.
- JResponseJson supports responding in JSON format to Ajax requests.
- Route / JRoute see URLs in Joomla
- Table / JTable provides functionality for performing CRUD operations (and more) on database tables. The guide is split into a Basic API Guide and an Advanced API Guide
- The Controllers (BaseController, AdminController, FormController, ApiController) are responsible for analysing the user's request, checking that the user is allowed to perform that action and determining how to satisfy the request.
- The Models (BaseModel, BaseDatabaseModel, ItemModel, ListModel, FormModel, AdminModel) encapsulate the data used by the component. They are also responsible for updating the database where appropriate.
- The Views (AbstractView, CategoriesView, CategoryFeedView, CategoryView, FormView, HtmlView, JsonApiView, JsonView, ListView) specify what should appear on the web page, and collates all the data necessary for outputting the HTTP response..
- Tags.
- Uri / JUri see URLs in Joomla
- User / JUser API related to the Joomla User.