JROUTER-GETINSTANCE-001
require JPATH_SITE . '/includes/router.php'
JRouter::getInstance() + includes/router.php
Manually including includes/router.php is gone. The router is on the application.
require JPATH_SITE . '/includes/router.php' → Autoloaded Router class
What you will see
- Failed opening required 'includes/router.php'
- Call to undefined method JRouter::getInstance
Symptoms people search
SEF router include fatal
Replace this code
Swap require JPATH_SITE . '/includes/router.php' for Autoloaded Router class.
Joomla 3
Remove or stop calling this
require_once JPATH_SITE . '/includes/router.php';
$router = JRouter::getInstance('site');Joomla 4 / 6
Use this instead
$router = Factory::getApplication()->getRouter();How to fix it
- 1Delete the require.
- 2Use $app->getRouter().
Also known as
includes/router.php · JRouter::getInstance
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::getUri()
JFactory::getUri() → Uri::getInstance()
- Joomla 3 → 4Joomla API
Factory::getXml() / JXMLElement
JFactory::getXML() → SimpleXMLElement
- Joomla 3 → 4Joomla API
Factory::getEditor()
JFactory::getEditor() → Editor::getInstance()