Magento 2: Get Current URL & Base URL

This article shows how we can get current and base URL in Magento 2. Both Dependency Injection and Object Manager ways of coding are given below. Using Dependency Injection (DI) Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of StoreManagerInterface & UrlInterface in the constructor of my module’s block … Read more