Skip to content

Commit

Permalink
Use the proper Packagist API (Fixes humbug#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
webflo committed Jul 25, 2017
1 parent 5c28f00 commit a882102
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Strategy/GithubStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

class GithubStrategy implements StrategyInterface
{
const API_URL = 'https://packagist.org/packages/%s.json';

const API_URL = 'https://packagist.org/p/%s.json';

const STABLE = 'stable';

Expand Down Expand Up @@ -101,7 +102,7 @@ public function getCurrentRemoteVersion(Updater $updater)
);
}

$versions = array_keys($package['package']['versions']);
$versions = array_keys($package['packages'][$this->getPackageName()]);
$versionParser = new VersionParser($versions);
if ($this->getStability() === self::STABLE) {
$this->remoteVersion = $versionParser->getMostRecentStable();
Expand Down Expand Up @@ -217,7 +218,7 @@ protected function getDownloadUrl(array $package)
$baseUrl = preg_replace(
'{\.git$}',
'',
$package['package']['versions'][$this->remoteVersion]['source']['url']
$package['packages'][$this->getPackageName()][$this->remoteVersion]['source']['url']
);
$downloadUrl = sprintf(
'%s/releases/download/%s/%s',
Expand Down

0 comments on commit a882102

Please sign in to comment.