Skip to content

Instantly share code, notes, and snippets.

@missoxd
Last active June 22, 2020 20:24
Show Gist options
  • Save missoxd/f5aaa186bb54013c9d4c32d0c62cc194 to your computer and use it in GitHub Desktop.
Save missoxd/f5aaa186bb54013c9d4c32d0c62cc194 to your computer and use it in GitHub Desktop.
Magento 2 custom script boilerplate
<?php
require __DIR__ . '/app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$objectManager->get('\Magento\Framework\App\State')->setAreaCode('adminhtml');
$registry = $objectManager->get('\Magento\Framework\Registry');
$registry->register('isSecureArea', 'true');
####################################################################################################
## BEGIN
####################################################################################################
## END
$registry->unregister('isSecureArea');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment