Applies to Joomla 4.4, 5.x and 6.x code that must run on Joomla 7 · extension developers Updated 16 Oct 2026

"JFactory is dead" is only half the story. The JFactory name already left Joomla core in 6.0: it now loads only through the Backward Compatibility 6 plugin. The bigger job is what comes next. The static getters on the namespaced Factory class are next: getUser(), getDbo(), getSession(), getLanguage(), getDocument(), getConfig(), getCache() and getMailer() are all marked "will be removed in 7.0". Replacing JFactory::getDbo() with Factory::getDbo() gets you through Joomla 6, and possibly no further.

On the 7.0-dev branch (October 2026, alpha) these getters are still there, and the compat plugin that carries JFactory is now Backward Compatibility 7, installed disabled. Don't plan on either surviving the final release.

This post shows where each of those services comes from in modern Joomla, per extension type, using the patterns core itself uses.

What stays on Factory, and what goes

Factory methodStatusReplacement
getApplication()stays(but prefer the injected application where you have one)
getContainer()staysthe DI container
getDate(), getStream()stay(new Date() works just as well)
getUser()marked for removal in 7.0$app->getIdentity(); other users: UserFactoryInterface::loadUserById()
getDbo()marked for removal in 7.0DatabaseAwareTrait + injection, or DatabaseInterface from the container
getSession(), getLanguage(), getDocument(), getConfig()marked for removal in 7.0the same getters on the application
getCache()marked for removal in 7.0CacheControllerFactoryInterface::createCacheController()
getMailer()marked for removal in 7.0MailerFactoryInterface::createMailer()

The rule behind the table: a class should receive its dependencies, not fetch them from a global. Joomla 4 added the container and the "aware" interfaces to make that possible. Joomla 7 is set to remove the shortcuts that let code ignore them.

Modules: the helper factory

A module written the Joomla 3 way has a static helper that calls Factory::getDbo(). The modern module (core's mod_articles_latest is a good reference) registers a helper factory in its service provider. The factory injects the database into any helper that implements DatabaseAwareInterface:

// modules/mod_example/services/provider.php
use Joomla\CMS\Extension\Service\Provider\HelperFactory;
use Joomla\CMS\Extension\Service\Provider\Module;
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;

return new class () implements ServiceProviderInterface {
    public function register(Container $container): void
    {
        $container->registerServiceProvider(new ModuleDispatcherFactory('\\Example\\Module\\Example'));
        $container->registerServiceProvider(new HelperFactory('\\Example\\Module\\Example\\Site\\Helper'));
        $container->registerServiceProvider(new Module());
    }
};
// modules/mod_example/src/Dispatcher/Dispatcher.php
namespace Example\Module\Example\Site\Dispatcher;

use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
use Joomla\CMS\Helper\HelperFactoryAwareInterface;
use Joomla\CMS\Helper\HelperFactoryAwareTrait;

class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
{
    use HelperFactoryAwareTrait;

    protected function getLayoutData(): array
    {
        $data = parent::getLayoutData();

        $data['items'] = $this->getHelperFactory()
            ->getHelper('ExampleHelper')
            ->getItems($data['params'], $this->getApplication());

        return $data;
    }
}
// modules/mod_example/src/Helper/ExampleHelper.php
namespace Example\Module\Example\Site\Helper;

use Joomla\CMS\Application\CMSApplicationInterface;
use Joomla\Database\DatabaseAwareInterface;
use Joomla\Database\DatabaseAwareTrait;
use Joomla\Registry\Registry;

class ExampleHelper implements DatabaseAwareInterface
{
    use DatabaseAwareTrait;

    public function getItems(Registry $params, CMSApplicationInterface $app): array
    {
        $db    = $this->getDatabase();                  // was: Factory::getDbo()
        $user  = $app->getIdentity();                   // was: Factory::getUser()
        $query = $db->createQuery()
            ->select($db->quoteName(['id', 'title']))
            ->from($db->quoteName('#__example_items'))
            ->whereIn($db->quoteName('access'), $user->getAuthorisedViewLevels())
            ->setLimit((int) $params->get('count', 5));

        return $db->setQuery($query)->loadObjectList();
    }
}

The helper is now a normal object. It can be unit-tested with a mock database, and it no longer depends on global state.

Plugins: inject in the service provider

Plugins get the application from CMSPlugin ($this->getApplication()). Everything else is injected when the plugin is built:

// plugins/system/example/services/provider.php
$container->set(PluginInterface::class, function (Container $container) {
    $plugin = new Example(
        $container->get(DispatcherInterface::class),
        (array) PluginHelper::getPlugin('system', 'example')
    );
    $plugin->setApplication(Factory::getApplication());
    $plugin->setDatabase($container->get(DatabaseInterface::class));   // the plugin uses DatabaseAwareTrait
    $plugin->setUserFactory($container->get(UserFactoryInterface::class)); // UserFactoryAwareTrait

    return $plugin;
});
// plugins/system/example/src/Extension/Example.php
final class Example extends CMSPlugin implements SubscriberInterface
{
    use DatabaseAwareTrait;
    use UserFactoryAwareTrait;

    public function onUserAfterSave(AfterSaveEvent $event): void
    {
        $author = $this->getUserFactory()->loadUserById((int) $event->getUser()['id']);   // was: Factory::getUser($id)
        $lang   = $this->getApplication()->getLanguage();                                // was: Factory::getLanguage()
        // …
    }
}

Components: models, views and controllers already have it

Inside a component, most of what you need is already a method call away, because the MVC factory injects it:

In a…OldModern
ModelFactory::getDbo(), $this->_db$this->getDatabase()
Model, HTML viewFactory::getUser()$this->getCurrentUser() (CurrentUserTrait)
ControllerFactory::getUser()$this->app->getIdentity()
ControllerFactory::getApplication()$this->app, injected
ViewFactory::getDocument(), $this->document$this->getDocument()
View$this->get('Items')$this->getModel()->getItems()
AnywhereBaseDatabaseModel::getInstance('Items', 'ExampleModel')$app->bootComponent('com_example')->getMVCFactory()->createModel('Items', 'Site')

Templates and layouts: use what you're given

In a template's index.php, $this is the document, so Factory::getDocument() is never needed there. In a layout override, the view is $this. Factory::getApplication() stays in Joomla 7 and is what core's Cassiopeia uses:

// templates/yourtemplate/index.php
$app  = Factory::getApplication();        // stays in Joomla 7
$wa   = $this->getWebAssetManager();      // was: Factory::getDocument()->getWebAssetManager()
$user = $app->getIdentity();              // was: Factory::getUser()
$lang = $app->getLanguage();              // was: Factory::getLanguage()

When there is no injection point

Some code really has nothing injected: a static callback, a legacy helper you can't restructure yet. Then go through the container, not a removed getter. It's still a global lookup, but it survives Joomla 7, and it is easy to find and refactor later:

use Joomla\CMS\Factory;
use Joomla\CMS\Mail\MailerFactoryInterface;
use Joomla\Database\DatabaseInterface;

$db     = Factory::getContainer()->get(DatabaseInterface::class);
$mailer = Factory::getContainer()->get(MailerFactoryInterface::class)->createMailer();

How we migrate an extension

  1. Log first. On Joomla 6, turn on Log Deprecated API and use every screen. administrator/logs/deprecated.php is the to-do list.
  2. Grep for the rest, see the commands in Joomla 7 breaking changes.
  3. Fix by class, not by line. Make the class "aware" (DatabaseAwareInterface, UserFactoryAwareInterface, MailerFactoryAwareInterface), inject in the provider or factory, then replace the calls. Replacing calls one by one with container lookups just moves the global around.
  4. Switch off the compat plugin options on the test site and click through again.
  5. Keep Joomla 5.4 support if your users need it. Everything above exists since Joomla 4.4, so one codebase covers 5.4, 6 and 7.