Example #1
0
 /**
  * Get a package's latest version.
  *
  * @param string $name
  *
  * @return string|void
  */
 public function getLatestVersion($name)
 {
     try {
         $package = $this->get($name);
         $versions = array_map(function ($version) {
             return $version->getVersion();
         }, $package->getVersions());
         return Version::latest($versions);
     } catch (ClientErrorResponseException $e) {
         return;
     }
 }
Example #2
0
 /**
  * Get latest package version.
  *
  * @param string $name
  *
  * @return string|void
  */
 public function getLatestVersion($name)
 {
     try {
         // Get all package versions.
         $versions = array_map(function ($version) {
             return $version->getVersion();
         }, $this->packagist->get($name)->getVersions());
         return Version::latest($versions);
     } catch (ClientErrorResponseException $e) {
         return;
     }
 }