php-alpm provides three top-level (non-class) functions.
function alpm_vercmp(string $ver1, string $ver2): int
Compares two pacman version strings the same way pacman -Q / libalpm does (epoch, then pkgver, then pkgrel).
pacman -Q
-1
$ver1
$ver2
0
1
echo alpm_vercmp("1.2.4-1", "1.5.3-2"); // -1 echo alpm_vercmp("1:1.5.2-1", "6.22.3-2"); // 1 (epoch wins) echo alpm_vercmp("1.2-1", "1.2-1"); // 0
function alpm_version(): string
Returns the version of the libalpm the extension was built against and is currently linked to, e.g. "16.0.1".
"16.0.1"
echo alpm_version();
function php_alpm_version(): string
Returns the version of the php-alpm extension itself, e.g. "0.9".
"0.9"
echo php_alpm_version();
There was an error while loading. Please reload this page.