Skip to content

Instantly share code, notes, and snippets.

@sankalpshekhar
Created August 18, 2020 13:52
Show Gist options
  • Select an option

  • Save sankalpshekhar/c35dbd0f4e15fa2bfc0ca5136395a020 to your computer and use it in GitHub Desktop.

Select an option

Save sankalpshekhar/c35dbd0f4e15fa2bfc0ca5136395a020 to your computer and use it in GitHub Desktop.
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require __DIR__ . '/app/bootstrap.php';
class SandboxApp extends \Magento\Framework\App\Http implements \Magento\Framework\AppInterface
{
public function launch()
{
$this->_state->setAreaCode('frontend');
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection');
echo '<pre>';
foreach($productCollection as $product) {
echo $product->getSku() . "\n";
}
echo '</pre>';
return $this->_response;
}
public function catchException(\Magento\Framework\App\Bootstrap $bootstrap, \Exception $exception)
{
return false;
}
}
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
$app = $bootstrap->createApplication('SandboxApp');
$bootstrap->run($app);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment