Hi friends, hope you are doing good. In today’s tutorial, I am going to share a very useful Magento code snippet to extend the Magento functionalities, please keep your close attention in this tutorial as I am going to share how to load the Magento 2 core in an external file.
Copy the below Magento code and use it in your custom PHP file to get the Magento 2 core functionality access.
* how to load the Magento 2 core in external file
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
Liked this program? Do Like & share with your friends.
Prem Tiwari is the founder of FreeWebMentor.com and also a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies. View all posts by Prem Tiwari