diff options
Diffstat (limited to 'class/PackagistClient.php')
-rw-r--r-- | class/PackagistClient.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/class/PackagistClient.php b/class/PackagistClient.php index 2fbb522..023ab1c 100644 --- a/class/PackagistClient.php +++ b/class/PackagistClient.php @@ -41,7 +41,7 @@ require_once 'Cache/Lite.php'; class PackagistClient { - const URL = 'https://packagist.org/'; + const URL = 'https://repo.packagist.org/'; protected $cache; function __construct () @@ -68,10 +68,9 @@ class PackagistClient return ($rep ? json_decode($rep, true) : false); } - function getPackage($name) + function getPackage($name, $crt=0, $max=0) { $unstable = array('alpha', 'beta', 'rc'); - $ret = false; $pkgs = $this->getPackageData($name); if ($pkgs) { @@ -81,7 +80,11 @@ class PackagistClient 'unstable' => NULL, 'state' => NULL, ); - foreach ($pkgs['package']['versions'] as $pkver => $pkg) { + foreach ($pkgs['package']['versions'] as $notused => $pkg) { + $pkver = $pkg['version']; + if ($pkver < $crt || $pkver > $max) { + continue; + } if (preg_match('/^v[0-9]/', $pkver)) { $pkver = substr($pkver, 1); } |