I'm trying to import Joomla in a Yii application. It goes well, but some plugins and libraries are not loaded. Does anyone know how to achieve this? Something like


This is my code so far:

    define('_JEXEC', 1); 

    $joomlaRootFolder = \Yii::$app->params['joomlaRootFolder'];

    if (file_exists($joomlaRootFolder . '/defines.php')) {
        include_once $joomlaRootFolder . '/defines.php';

    if (!defined('_JDEFINES')) {
        define('JPATH_BASE', $joomlaRootFolder);
        require_once JPATH_BASE . '/includes/defines.php';

    require_once JPATH_BASE . '/includes/framework.php';

    // Instantiate the application.
    $app = \JFactory::getApplication('site');

    // Breaks here!

The library works as expected in our Joomla code, so that's not the problem.

Edit: My solution was to manually call


Seems like this was not done in the $app->initialise() method.

  • If you have solved your own issue, please post the solution as an answer so future readers can look in "expected" places on the page for "expected" information. After you have posted a clear, complete, educational answer that can benefit others, you may award your answer the green tick so that the question is deemed to be "resolved" by the system and future researchers will know that this is a working solution. (Please minimize tabbing in your code blocks for easier reading -- less horizontal scrolling.) – mickmackusa Sep 14 '18 at 23:05

As stated in my edit of the question, the solution was to include



$app = \JFactory::getApplication('site');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.