Get application version from composer file

@return string
183869
public function getVersion()
  {
    $composerJson = config('app.dir') . 'composer.json';

    if (file_exists($composerJson)) {
      $composer = json_decode(file_get_contents($composerJson, true));

      $version  = isset($composer->version) ? $composer->version : '1';
      $require  = isset($composer->require) ? (array)$composer->require : false;

      if (!is_array($require)) return "{$version} (1)";

      if (isset($require['modulusphp/framework'])) {
        return $version . " ({$require['modulusphp/framework']})";
      } else {
        return "{$version} (1)";
      }
    }

    return '1';
  }
765303
public function getVersion() : ?string 
    {
        if ( ! $this->hasVersion()) {
            $this->setVersion($this->getDefaultVersion());
        }
        return $this->version;
    }
1028138
public function getPlatformVersion() { 
		if ($this->_platformVersion === self::PLATFORM_UNKNOWN ) 
		{
			$this->_platformVersion = $this->_platform;
		}
		return $this->_platformVersion; 
	}
1155147
public function getVersion() {
    $version = $this->Cache->read('version', null);
    if ($version !== null) {
      return $version;
    }
    $version = array(2, 0, 0);

    $lines = array();
    $result = $this->Process->run($this->config['ffmpeg.bin'], array('-version'), $lines);
    if ($result == 0 && $lines && preg_match('/^\w+\s(version\s)?(\d+)\.(\d+)\.(\d+).*/', $lines[0], $m)) {
      $version = array($m[2], $m[3], $m[4]);
    } else if ($result == 0 && $lines && preg_match('/^\w+\s(version\s)?\S*N-(\d+)-.*/', $lines[0], $m)) {
      $winVersion = $m[2];
      if ($winVersion <= 30610) {
        $version = array(0, 6, 0);
      } else if ($winVersion <= 30956) {
        $version = array(0, 7, 0);
      } else if ($winVersion <= 48409) {
        $version = array(0, 8, 0);
      } else if ($winVersion <= 48610) {
        $version = array(1, 0, 1);
      } else if ($winVersion <= 49044) {
        $version = array(1, 1, 0);
      } else {
        $version = array(2, 0, 0);
      }
    }
    $this->Cache->write('version', $version);
    return $version;
  }
1051860
protected function version()
    {
        $version = $this->argument('version');

        if (! $version) {
            return $this->latestVersion();
        }

        if (! ctype_digit($version)) {
            return $version;
        }

        $version = (int) $version;

        if ($version < 70) {
            return $this->legacyVersions[$version];
        }

        return trim(file_get_contents(
            sprintf($this->versionUrl, $version)
        ));
    }
1359862
public function getDrushMajorVersion() {
    $version_info = json_decode($this->executor->drush('version --format=json')->run()->getMessage(), TRUE);
    if (!empty($version_info['drush-version'])) {
      $version = $version_info['drush-version'];
    }
    else {
      $version = $version_info;
    }

    $major_version = substr($version, 0, 1);

    return (int) $major_version;
  }
980038
public function getVersion()
	{
		if( ( $content = @file_get_contents( base_path( 'composer.lock' ) ) ) !== false
			&& ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] )
		) {
			foreach( (array) $content['packages'] as $item )
			{
				if( $item['name'] === 'aimeos/aimeos-laravel' ) {
					return $item['version'];
				}
			}
		}

		return '';
	}
727160
public function getVersion()
    {
        $composer = $this->loadJsonFileFromRoot("composer.json");

        if (!isset($composer->version)){
            throw new \Exception("composer.json does not contain a version");
        }

        return $composer->version;
    }
719237
public function getVersion($of = 'atk')
    {
        // TODO: get version of add-on
        if (!$this->version_cache) {
            $f = $this->app->pathfinder->atk_location->base_path.DIRECTORY_SEPARATOR.'VERSION';
            if (file_exists($f)) {
                $this->version_cache = trim(file_get_contents($f));
            } else {
                $this->version_cache = '4.0.1';
            }
        }

        return $this->version_cache;
    }
463366
public static function getSolrMajorVersion() {
        $type = static::getSolrType();
        $version = FALSE;
        if ($type) {
            list(, $version) = explode(":", $type);
            if (preg_match('/^(\d)\./', $version, $matches)) {
                $version = $matches[1];
            }
            else {
                $version = '4';
            }
            // Platform support 3,4 and 6 atm. We only support 4 and 6.
            if ($version === '3') {
                $version = '4';
            }
        }
        return $version;
    }
1104407
protected function getPhpRequiredVersion()
    {
        if (!file_exists($path = __DIR__.'/../composer.lock')) {
            return false;
        }

        $composerLock = json_decode(file_get_contents($path), true);
        foreach ($composerLock['packages'] as $package) {
            $name = $package['name'];
            if ('symfony/symfony' !== $name && 'symfony/http-kernel' !== $name) {
                continue;
            }

            return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION;
        }

        return false;
    }
652851
public static function getTheliaSimpleVersion()
    {
        $majorVersion = self::read('thelia_major_version');
        $minorVersion = self::read('thelia_minus_version');
        $releaseVersion = self::read('thelia_release_version');

        return $majorVersion.'.'.$minorVersion.'.'.$releaseVersion;
    }
791646
private function getAppVersion()
    {
        $version = $this->app->version();
        if (substr($version, 0, 7) === 'Lumen (') {
            $version = array_first(explode(')', str_replace('Lumen (', '', $version)));
        }
        return $version;
    }
352474
function () {
  var version = 'UnknownComposer';
  var versionString = shell.exec('composer --version', {silent: true}).output;
  // Example below:
  //    Composer version 1.0.0-alpha9 2014-12-07 17:15:20
  var versionRegex = /Composer version (\S+)/;
  var result = versionRegex.exec(versionString);
  if (result !== null) {
    version = result[1];
  } else {
    logger.logInfo('Could not find composer version from version string: ' + versionString);
  }
  return version;
}
589682
public function getVersion()
    {
        if ($this->version) {
            return $this->version;
        }

        if ($this->config->get('system.debug')) {
            return $this->version = md5(uniqid('Windwalker-Asset-Version', true));
        }

        $sumFile = $this->config->get('path.cache') . '/asset/MD5SUM';

        if (!is_file($sumFile)) {
            return $this->version = $this->detectVersion();
        }

        return $this->version = trim(file_get_contents($sumFile));
    }
1331269
protected function defaultVersion()
    {
        $packageInfo = Json::decode(file_get_contents(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'composer.json'));
        $extensionName = $packageInfo['name'];
        if (isset(Yii::$app->extensions[$extensionName])) {
            return Yii::$app->extensions[$extensionName]['version'];
        }
        return parent::defaultVersion();
    }
720472
function getVersion()
    {
        if (empty($this->version))
            $this->version = self::Vx1_1;
        
        return $this->version;
    }