How to get access to working directories in Magento 2

- Magento 2

Magento 2 Development

To get access to working directories in Magento 2, you can declare the class in __constract:

'

Use the method to perform the actions:

– get the root directory of Magento 2:


– or any working Magento 2 directory:

– connect url to it:


You can rely on the following working directories since they are available as arguments:

More tips from Magento 2 Developer’s Cookbook

Source

'