How To Use Class in Root Script in Magento 2

Use Class in Root Script in Magento 2

Root scripts in Magento 2 quickens the process of retrieving the data like getting the server time and store time. Creating a root script in Magento 2 helps developer to save the time. However, a root script has a problem too. In root scripts, we cannot take the complete advantage of IDE auto-completion which boosts the productivity of the developers.

By leveraging the class in a root script, the IDE starts supporting auto-completion facility. Hence, it’s a better choice for developers.

This post explains the programmatic solution to use class in root script in Magento 2.

Programmatic Solution to Use Class in Root Script in Magento 2

Done! Here you go.

Any doubts? Feel free to ask in the Comment section below.

I would be happy to answer.

Do consider sharing this post with Magento Community via social media.

Thank you.

Get Weekly Updates

Never miss Magento tips, tricks, tutorials, and news.

Thank you for subscribing.

Something went wrong.

(based on 12 Reviews)

Yash is a Magento Developer at Meetanshi. He loves playing computer games and watching action movies. For brain exercise, he likes to play Chess.

Leave a reply:

Your email address will not be published.