I am trying to figure out what the equivalent of the following piece of Magento 1 code would be in Magento 2.

I am trying to include magento 2 into a external file as follows:

Magento 1 Code:

$MAGENTO_BASE_DIR = '/mySite.com/'

Would the following Magento 2 Code suffice:

$MAGENTO_BASE_DIR = '/mySite.com/';
require($MAGENTO_BASE_DIR . 'app/bootstrap.php');

Not sure if the above magento 2 code is entirely correct?

Thanks in advance


Browse other questions tagged or ask your own question.