JFACTORY-GETURI-001
JFactory::getUri()
Factory::getUri()
getUri() was removed from Factory in Joomla 4. Use the Uri class.
JFactory::getUri() → Uri::getInstance()
What you will see
- Call to undefined method Joomla\CMS\Factory::getUri
- Call to undefined method JFactory::getURI
Symptoms people search
canonical URL code fatals
Replace this code
Swap JFactory::getUri() for Uri::getInstance().
Joomla 3
Remove or stop calling this
$uri = JFactory::getURI();
echo $uri->toString();Joomla 4 / 6
Use this instead
use Joomla\CMS\Uri\Uri;
$uri = Uri::getInstance();How to fix it
- 1Replace Factory::getUri()/getURI() with Uri::getInstance().
Also known as
JFactory::getUri()
Related issues
- Joomla 3 → 4Joomla API
JRequest::getVar() and the whole JRequest API
JRequest::getVar() → $app->getInput()->get('id')
- Joomla 3 → 4Joomla API
JError / JException
JError::raiseError() → throw new RuntimeException() / try-catch
- Joomla 3 → 4Joomla API
isAdmin() / isSite()
$app->isAdmin() → $app->isClient('administrator') / isClient('site')
- Joomla 3 → 4Joomla API
Factory::getXml() / JXMLElement
JFactory::getXML() → SimpleXMLElement
- Joomla 3 → 4Joomla API
Factory::getEditor()
JFactory::getEditor() → Editor::getInstance()
- Joomla 3 → 4Joomla API
JHtmlBatch
JHtmlBatch → Layouts joomla.html.batch.*