What's the best way to get the current mode Magento 2 is running with code?
In my case it's for a headless Magento, but I can see a number of cases where this might be required.
developer-modemagento-2.1magento2production-mode
What's the best way to get the current mode Magento 2 is running with code?
In my case it's for a headless Magento, but I can see a number of cases where this might be required.
Best Answer
If you're referring to the deployment mode, you can do it via the CLI using:
If you need to do it via pure code you can use: