Any experience using Mage.php from Magento inside Lumen? I'm trying to get some data from Magento, I have Lumen in a folder in Magento Root
Magento Root
I'm trying to connect to Magento using this on index.php
require_once('../../app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
But I get
ErrorException in Autoload.php line 94: include(App\Http\Controllers\Mage.php): failed to open stream: No such file or directory
Anyone with experience on this?
Magentos "Mage" class seems to be in the global namespace and your are in the App\Http\Controllers namespace. You need to at least prefix the call with an backslash to tell php to look in the global namespace:
\Mage::app();
You should read about namespaces in the php documentation.
Cheers.
Thank you, I found another way to do this, but will try this.
Thank you again
@elfeffe any update on how you managed to get this to work? I'm trying out something similar and haven't had any luck yet
We used
use \Mage;
/**
* Create a new instance.
*
*/
public function __construct()
{
require_once(env('MAGENTO_PATH'));
Mage::app();
}
Please sign in or create an account to participate in this conversation.