Skip to content

Instantly share code, notes, and snippets.

@ananth-iyer
Created February 27, 2019 08:01
Show Gist options
  • Save ananth-iyer/53ea7d802fa79f41e7578dc9776801e8 to your computer and use it in GitHub Desktop.
Save ananth-iyer/53ea7d802fa79f41e7578dc9776801e8 to your computer and use it in GitHub Desktop.
Know the Magento edition in codebase like Community or Enterprise
<?php
use Magento\Framework\App\Bootstrap;
require __DIR__ . '/app/bootstrap.php';
$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);
$obj = $bootstrap->getObjectManager();
$state = $obj->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');
/** @var \Magento\Framework\App\ProductMetadataInterface $productMetadata */
$productMetadata = $obj->get('Magento\Framework\App\ProductMetadataInterface');
$data = [];
$data[] = $productMetadata->getName(); //will return the magento name
$data[] = $productMetadata->getEdition(); //will return the magento edition - Community or Enterprise
$data[] = $productMetadata->getVersion(); //will return the magento version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment