Get Magento version in Magento 2

Wondering which Magento 2 version are you using? In this blog post we will check together the ways to get the Magento version of your Magento 2 installation.

There are 5 ways to check the Magento version in Magento 2, writing code and not.

1. Using the followng CLI command on your magento root folder

php bin/magento --version

which returns in our example

Magento CLI version 2.2.6

2. Using the following url in your browser

http://demo.magevision.com/magento_version

which returns in our example

Magento/2.2 (Community)

3. Checking the composer.json file on your root folder you will find in the require section the following line

"magento/product-community-edition": "2.2.6"

4. Using the following code (Objectmanager is used only in the example, not recommended. Instead use dependency injection.)

$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); 

$productMetadata = $objectManager->get('Magento\Framework\App\ProductMetadataInterface'); 

$version = $productMetadata->getVersion();

5. Easily login into Magento admin and on the right side of the footer you will see

Magento ver. 2.2.6

Just choose the right way for you!

Feel free to share this post and ask your questions in the comments below.

Till next time!