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';
  }
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';
  }
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' ; }
Get application version from composer file

@return string
Get application version from composer file