Skip to content

Instantly share code, notes, and snippets.

@mrkhoa99
Last active July 14, 2022 05:03
Show Gist options
  • Save mrkhoa99/b8648168406cb222f5800e7ec0ebc603 to your computer and use it in GitHub Desktop.
Save mrkhoa99/b8648168406cb222f5800e7ec0ebc603 to your computer and use it in GitHub Desktop.
Dirty Playground Magento 2
//put under pub/test.php
<?php
require dirname(__FILE__) . '/../app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('TestApp');
$bootstrap->run($app);
//Put under pub/TestApp.php
<?php
class TestApp extends \Magento\Framework\App\Http
implements \Magento\Framework\AppInterface {
public function launch()
{
//Using object Manager
// $object = $this->_objectManager->get('your classs');
echo "Hello World! My Dirty Playground";
return $this->_response;
}
public function catchException(
\Magento\Framework\App\Bootstrap $bootstrap,
\Exception $exception
)
{
return false;
}
}
@mrkhoa99
Copy link
Author

Open http://<your_magento_host>/pub/test.php to see the result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment