Last active
September 24, 2020 11:00
-
-
Save ananth-iyer/dcdc0fb3ceed3c965503bd59b54b2f62 to your computer and use it in GitHub Desktop.
Magento 2 External script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Magento\Framework\App\Bootstrap; | |
require __DIR__ . '/app/bootstrap.php'; | |
$bootstrap = Bootstrap::create(BP, $_SERVER); | |
$obj = $bootstrap->getObjectManager(); | |
// set frontend scope - necessary | |
/** @var \Magento\Framework\App\State $state */ | |
$state = $obj->get(\Magento\Framework\App\State::class); | |
$state->setAreaCode('adminhtml'); // others: frontend, crontab | |
/** @var \Magento\Store\Model\StoreManagerInterface $store */ | |
$store = $obj->get(\Magento\Store\Model\StoreManagerInterface::class); | |
$store->setCurrentStore(0); | |
echo "Start..."; | |
/** @var \class_path $_curl */ | |
$class = $obj->create(<class path>::class); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment