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 at 23:05
up vote 0 down vote accepted

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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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