Helper/Helper.php
public function getModuleVersion() {
        // Get the module path
        $module_path = $this->directoryReader->getModuleDir('', 'CheckoutCom_Magento2');

        // Get the content of composer.json
        $json = file_get_contents($module_path . '/composer.json');

        // Decode the data and return
        $data = json_decode($json);

        return $data->version;
    }
public function getModuleVersion() {
        // Get the module path
        $module_path = $this->directoryReader->getModuleDir('', 'CheckoutCom_Magento2');

        // Get the content of composer.json
        $json = file_get_contents($module_path . '/composer.json');

        // Decode the data and return
        $data = json_decode($json);

        return $data->version;
    }
public function getModuleVersion ( ) { // Get the module path $ module_path = $ this -> directoryReader -> getModuleDir ( '' , 'CheckoutCom_Magento2' ) ; // Get the content of composer.json $ json = file_get_contents ( $ module_path . '/composer.json' ) ; // Decode the data and return $ data = json_decode ( $ json ) ; return $ data -> version ; }
Get the module version from composer.json file
Get the module version from composer . json file