PHPackages                             joomla/model - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. joomla/model

ActiveJoomla-package[Framework](/categories/framework)

joomla/model
============

Joomla Model Package

4.0.1(11mo ago)323.4k7GPL-2.0-or-laterPHPPHP ^8.3.0CI failing

Since Jun 4Pushed 11mo ago11 watchersCompare

[ Source](https://github.com/joomla-framework/model)[ Packagist](https://packagist.org/packages/joomla/model)[ Docs](https://github.com/joomla-framework/model)[ RSS](/packages/joomla-model/feed)WikiDiscussions 3.x-dev Synced 3w ago

READMEChangelog (6)Dependencies (6)Versions (21)Used By (0)

The Model Package [![Build Status](https://github.com/joomla-framework/model/actions/workflows/ci.yml/badge.svg?branch=3.x-dev)](https://github.com/joomla-framework/model)
===========================================================================================================================================================================

[](#the-model-package-)

[![Latest Stable Version](https://camo.githubusercontent.com/d1ecdf4fb80764ddc27cc14df01a62405eb2c2951fc7a995137354c0c735a6e6/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f6d6f64656c2f762f737461626c65)](https://packagist.org/packages/joomla/model)[![Total Downloads](https://camo.githubusercontent.com/a43147621761a3addedce69307cb1b61e3461cdedf1d2f358b89ddb9e2b446b6/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f6d6f64656c2f646f776e6c6f616473)](https://packagist.org/packages/joomla/model)[![Latest Unstable Version](https://camo.githubusercontent.com/fb567da8f5aac704ec44c65f79d5d533cf430d7352074797abe6767f85411656/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f6d6f64656c2f762f756e737461626c65)](https://packagist.org/packages/joomla/model)[![License](https://camo.githubusercontent.com/791cfb3ec7136783f7f50530506d93f0af4877516883ecc06223b35407cdc861/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f6d6f64656c2f6c6963656e7365)](https://packagist.org/packages/joomla/model)

Interfaces
----------

[](#interfaces)

### `Model\ModelInterface`

[](#modelmodelinterface)

`Model\ModelInterface` is an interface that requires a class to be implemented with a `getState` and a `setState` method.

Classes
-------

[](#classes)

`Model\AbstractModel`
=====================

[](#modelabstractmodel)

#### Construction

[](#construction)

The contructor for a new `Model\AbstractModel` object takes an optional `Registry` object that defines the state of the model. If omitted, an empty `Registry` object will be assigned automatically.

#### Usage

[](#usage)

The `Model\AbstractModel` class is abstract. All requirements of the interface are already satisfied by the base class.

```
namespace MyApp;

use Joomla\Model\AbstractModel;

/**
 * My custom model.
 *
 * @pacakge  Examples
 *
 * @since   1.0
 */
class MyModel extends AbstractModel
{
  /**
	 * Get the time.
	 *
	 * @return  integer
	 *
	 * @since   1.0
	 */
	public function getTime()
	{
		return time();
	}
}
```

`Model\AbstractDatabaseModel`
=============================

[](#modelabstractdatabasemodel)

#### Construction

[](#construction-1)

`Model\AbstractDatabaseModel` is extended from `Model\AbstractModel` and the contructor takes a required `Database\DatabaseDriver` object and an optional `Registry` object.

#### Usage

[](#usage-1)

The `Model\AbstractDatabaseModel` class is abstract so cannot be used directly. It forms a base for any model that needs to interact with a database.

```
namespace MyApp

use Joomla\Model;
use Joomla\Database;

/**
 * My custom database model.
 *
 * @package  Examples
 *
 * @since   1.0
 */
class MyDatabaseModel extends Model\AbstractDatabaseModel
{
	/**
	 * Get the content count.
	 *
	 * @return  integer
	 *
	 * @since   1.0
	 * @throws  RuntimeException on database error.
	 */
	public function getCount()
	{
		// Get the query builder from the internal database object.
		$q = $this->db->getQuery(true);

		// Prepare the query to count the number of content records.
		$q->select('COUNT(*)')->from($q->qn('#__content'));

		$this->db->setQuery($q);

		// Execute and return the result.
		return $this->db->loadResult();
	}
}

try
{
	$driver = Database\DatabaseFactory::getInstance()->getDriver('mysqli');
	$model = new MyDatabaseModel($driver);
	$count = $model->getCount();
}
catch (RuntimeException $e)
{
	// Handle database error.
}
```

Installation via Composer
-------------------------

[](#installation-via-composer)

Add `"joomla/model": "~3.0"` to the require block in your composer.json and then run `composer install`.

```
{
	"require": {
		"joomla/model": "~3.0"
	}
}
```

Alternatively, you can simply run the following from the command line:

```
composer require joomla/model "~3.0"
```

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance52

Moderate activity, may be stable

Popularity31

Limited adoption so far

Community26

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 58.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~277 days

Recently: every ~163 days

Total

17

Last Release

336d ago

Major Versions

1.3.0 → 2.0.0-beta2020-06-05

2.0.1 → 3.0.02023-10-08

3.0.2 → 4.0.02025-07-19

PHP version history (6 changes)1.0-alphaPHP &gt;=5.3.10

1.3.0PHP ^5.3.10|~7.0

2.0.0-betaPHP ^7.2.5

2.0.1PHP ^7.2.5|~8.0.0|~8.1.0

3.0.0PHP ^8.1.0

4.0.0PHP ^8.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/305a2164440014dcef9ac681c139fe5e8a1ce1d7a8c3b3cfb828497729a4c70e?d=identicon)[wilsonge](/maintainers/wilsonge)

![](https://avatars.githubusercontent.com/u/42966168?v=4)[Release-Joomla](/maintainers/release-joomla)[@release-joomla](https://github.com/release-joomla)

![](https://avatars.githubusercontent.com/u/313866?v=4)[Hannes Papenberg](/maintainers/Hackwar)[@Hackwar](https://github.com/Hackwar)

---

Top Contributors

[![mbabker](https://avatars.githubusercontent.com/u/368545?v=4)](https://github.com/mbabker "mbabker (77 commits)")[![Hackwar](https://avatars.githubusercontent.com/u/313866?v=4)](https://github.com/Hackwar "Hackwar (22 commits)")[![dongilbert](https://avatars.githubusercontent.com/u/718028?v=4)](https://github.com/dongilbert "dongilbert (8 commits)")[![nibra](https://avatars.githubusercontent.com/u/827605?v=4)](https://github.com/nibra "nibra (5 commits)")[![wilsonge](https://avatars.githubusercontent.com/u/1986000?v=4)](https://github.com/wilsonge "wilsonge (4 commits)")[![ianmacl](https://avatars.githubusercontent.com/u/176534?v=4)](https://github.com/ianmacl "ianmacl (3 commits)")[![joomla-jenkins](https://avatars.githubusercontent.com/u/929228?v=4)](https://github.com/joomla-jenkins "joomla-jenkins (2 commits)")[![realityking](https://avatars.githubusercontent.com/u/628508?v=4)](https://github.com/realityking "realityking (2 commits)")[![heelc29](https://avatars.githubusercontent.com/u/66922325?v=4)](https://github.com/heelc29 "heelc29 (2 commits)")[![photodude](https://avatars.githubusercontent.com/u/10253980?v=4)](https://github.com/photodude "photodude (1 commits)")[![richard67](https://avatars.githubusercontent.com/u/7413183?v=4)](https://github.com/richard67 "richard67 (1 commits)")[![eddieajau](https://avatars.githubusercontent.com/u/700871?v=4)](https://github.com/eddieajau "eddieajau (1 commits)")[![jbanety](https://avatars.githubusercontent.com/u/1055330?v=4)](https://github.com/jbanety "jbanety (1 commits)")[![elkuku](https://avatars.githubusercontent.com/u/33978?v=4)](https://github.com/elkuku "elkuku (1 commits)")[![PhilETaylor](https://avatars.githubusercontent.com/u/400092?v=4)](https://github.com/PhilETaylor "PhilETaylor (1 commits)")

---

Tags

joomlajoomla-frameworkmodelmvcphpframeworkmodeljoomla

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/joomla-model/health.svg)

```
[![Health](https://phpackages.com/badges/joomla-model/health.svg)](https://phpackages.com/packages/joomla-model)
```

###  Alternatives

[joomla/filter

Joomla Filter Package

151.5M10](/packages/joomla-filter)[joomla/application

Joomla Application Package

23430.4k13](/packages/joomla-application)[joomla/registry

Joomla Registry Package

16505.8k21](/packages/joomla-registry)[joomla/filesystem

Joomla Filesystem Package

11394.8k7](/packages/joomla-filesystem)[joomla/oauth2

Joomla OAuth2 Package

10326.4k2](/packages/joomla-oauth2)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
