array ( 'pretty_version' => 'dev-master', 'version' => 'dev-master', 'aliases' => array ( ), 'reference' => '581243b285fdc522b90e3e9bbc31a78af21526f8', 'name' => '__root__', ), 'versions' => array ( '__root__' => array ( 'pretty_version' => 'dev-master', 'version' => 'dev-master', 'aliases' => array ( ), 'reference' => '581243b285fdc522b90e3e9bbc31a78af21526f8', ), 'doctrine/inflector' => array ( 'pretty_version' => '2.0.3', 'version' => '2.0.3.0', 'aliases' => array ( ), 'reference' => '9cf661f4eb38f7c881cac67c75ea9b00bf97b210', ), 'illuminate/collections' => array ( 'pretty_version' => 'v8.44.0', 'version' => '8.44.0.0', 'aliases' => array ( ), 'reference' => 'deccb956d38710f3f8baf36dd876c3fa1585ec22', ), 'illuminate/container' => array ( 'pretty_version' => 'v8.44.0', 'version' => '8.44.0.0', 'aliases' => array ( ), 'reference' => '07342efca88cf9fff4f2fa0e3c378ea6ee86e5e2', ), 'illuminate/contracts' => array ( 'pretty_version' => 'v8.44.0', 'version' => '8.44.0.0', 'aliases' => array ( ), 'reference' => 'b9a7cf6acf1d05d863b6ef67c00cdb0e4ccea097', ), 'illuminate/database' => array ( 'pretty_version' => 'v8.44.0', 'version' => '8.44.0.0', 'aliases' => array ( ), 'reference' => 'c8a1d6c4bd636779cdf3c3b93d0b149472278070', ), 'illuminate/macroable' => array ( 'pretty_version' => 'v8.44.0', 'version' => '8.44.0.0', 'aliases' => array ( ), 'reference' => '300aa13c086f25116b5f3cde3ca54ff5c822fb05', ), 'illuminate/support' => array ( 'pretty_version' => 'v8.44.0', 'version' => '8.44.0.0', 'aliases' => array ( ), 'reference' => '8a2db3cb7e76fdbd28c6172492a79ab540a9b8e5', ), 'nesbot/carbon' => array ( 'pretty_version' => '2.48.1', 'version' => '2.48.1.0', 'aliases' => array ( ), 'reference' => '8d1f50f1436fb4b05e7127360483dd9c6e73da16', ), 'psr/container' => array ( 'pretty_version' => '1.1.1', 'version' => '1.1.1.0', 'aliases' => array ( ), 'reference' => '8622567409010282b7aeebe4bb841fe98b58dcaf', ), 'psr/container-implementation' => array ( 'provided' => array ( 0 => '1.0', ), ), 'psr/log-implementation' => array ( 'provided' => array ( 0 => '1.0', ), ), 'psr/simple-cache' => array ( 'pretty_version' => '1.0.1', 'version' => '1.0.1.0', 'aliases' => array ( ), 'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b', ), 'symfony/console' => array ( 'pretty_version' => 'v5.3.0', 'version' => '5.3.0.0', 'aliases' => array ( ), 'reference' => '058553870f7809087fa80fa734704a21b9bcaeb2', ), 'symfony/deprecation-contracts' => array ( 'pretty_version' => 'v2.4.0', 'version' => '2.4.0.0', 'aliases' => array ( ), 'reference' => '5f38c8804a9e97d23e0c8d63341088cd8a22d627', ), 'symfony/polyfill-ctype' => array ( 'pretty_version' => 'v1.23.0', 'version' => '1.23.0.0', 'aliases' => array ( ), 'reference' => '46cd95797e9df938fdd2b03693b5fca5e64b01ce', ), 'symfony/polyfill-intl-grapheme' => array ( 'pretty_version' => 'v1.23.0', 'version' => '1.23.0.0', 'aliases' => array ( ), 'reference' => '24b72c6baa32c746a4d0840147c9715e42bb68ab', ), 'symfony/polyfill-intl-normalizer' => array ( 'pretty_version' => 'v1.23.0', 'version' => '1.23.0.0', 'aliases' => array ( ), 'reference' => '8590a5f561694770bdcd3f9b5c69dde6945028e8', ), 'symfony/polyfill-mbstring' => array ( 'pretty_version' => 'v1.23.0', 'version' => '1.23.0.0', 'aliases' => array ( ), 'reference' => '2df51500adbaebdc4c38dea4c89a2e131c45c8a1', ), 'symfony/polyfill-php73' => array ( 'pretty_version' => 'v1.23.0', 'version' => '1.23.0.0', 'aliases' => array ( ), 'reference' => 'fba8933c384d6476ab14fb7b8526e5287ca7e010', ), 'symfony/polyfill-php80' => array ( 'pretty_version' => 'v1.23.0', 'version' => '1.23.0.0', 'aliases' => array ( ), 'reference' => 'eca0bf41ed421bed1b57c4958bab16aa86b757d0', ), 'symfony/service-contracts' => array ( 'pretty_version' => 'v2.4.0', 'version' => '2.4.0.0', 'aliases' => array ( ), 'reference' => 'f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb', ), 'symfony/string' => array ( 'pretty_version' => 'v5.3.0', 'version' => '5.3.0.0', 'aliases' => array ( ), 'reference' => 'a9a0f8b6aafc5d2d1c116dcccd1573a95153515b', ), 'symfony/translation' => array ( 'pretty_version' => 'v5.3.0', 'version' => '5.3.0.0', 'aliases' => array ( ), 'reference' => '251de0d921c42ef0a81494d8f37405421deefdf6', ), 'symfony/translation-contracts' => array ( 'pretty_version' => 'v2.4.0', 'version' => '2.4.0.0', 'aliases' => array ( ), 'reference' => '95c812666f3e91db75385749fe219c5e494c7f95', ), 'symfony/translation-implementation' => array ( 'provided' => array ( 0 => '2.3', ), ), 'voku/portable-ascii' => array ( 'pretty_version' => '1.5.6', 'version' => '1.5.6.0', 'aliases' => array ( ), 'reference' => '80953678b19901e5165c56752d087fc11526017c', ), ), ); private static $canGetVendors; private static $installedByVendor = array(); public static function getInstalledPackages() { $packages = array(); foreach (self::getInstalled() as $installed) { $packages[] = array_keys($installed['versions']); } if (1 === \count($packages)) { return $packages[0]; } return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); } public static function isInstalled($packageName) { foreach (self::getInstalled() as $installed) { if (isset($installed['versions'][$packageName])) { return true; } } return false; } public static function satisfies(VersionParser $parser, $packageName, $constraint) { $constraint = $parser->parseConstraints($constraint); $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); return $provided->matches($constraint); } public static function getVersionRanges($packageName) { foreach (self::getInstalled() as $installed) { if (!isset($installed['versions'][$packageName])) { continue; } $ranges = array(); if (isset($installed['versions'][$packageName]['pretty_version'])) { $ranges[] = $installed['versions'][$packageName]['pretty_version']; } if (array_key_exists('aliases', $installed['versions'][$packageName])) { $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); } if (array_key_exists('replaced', $installed['versions'][$packageName])) { $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); } if (array_key_exists('provided', $installed['versions'][$packageName])) { $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); } return implode(' || ', $ranges); } throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } public static function getVersion($packageName) { foreach (self::getInstalled() as $installed) { if (!isset($installed['versions'][$packageName])) { continue; } if (!isset($installed['versions'][$packageName]['version'])) { return null; } return $installed['versions'][$packageName]['version']; } throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } public static function getPrettyVersion($packageName) { foreach (self::getInstalled() as $installed) { if (!isset($installed['versions'][$packageName])) { continue; } if (!isset($installed['versions'][$packageName]['pretty_version'])) { return null; } return $installed['versions'][$packageName]['pretty_version']; } throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } public static function getReference($packageName) { foreach (self::getInstalled() as $installed) { if (!isset($installed['versions'][$packageName])) { continue; } if (!isset($installed['versions'][$packageName]['reference'])) { return null; } return $installed['versions'][$packageName]['reference']; } throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } public static function getRootPackage() { $installed = self::getInstalled(); return $installed[0]['root']; } public static function getRawData() { return self::$installed; } public static function reload($data) { self::$installed = $data; self::$installedByVendor = array(); } private static function getInstalled() { if (null === self::$canGetVendors) { self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); } $installed = array(); if (self::$canGetVendors) { foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { if (isset(self::$installedByVendor[$vendorDir])) { $installed[] = self::$installedByVendor[$vendorDir]; } elseif (is_file($vendorDir.'/composer/installed.php')) { $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; } } } $installed[] = self::$installed; return $installed; } }