How to get base directory programmatically in Magento 2

- Fire development, Magento 2

Magento 2 Development

It is possible to get base directory programmatically in Magento 2 the same way as you do it in 1.x, since it is available in the constant BP:

Source

More tips from the cookbook