Redeem Now
Read More
Read now
Menu Close
    Start a Project Request quote Reading list Switch to dark mode

    How to Get Module Directory Path in Magento 2

    Hello Readers! In this blog I will show you how can you get the path of any installed modules. Also the path of some folders related to the module such as etc, controller folders.

    To get the paths you need take help of \Magento\Framework\Module\Dir class as shown below,

    If we do not provide any second parameter then getDir method will return path to module’s directory. We can provide the second parameter to get the specific folders of a module.

    Thanks for reading the blog. Feel free to comment if you face any issue.

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*

    Be the first to comment.

    Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again