Voici quelques exemples de son utilisation.

Comparaison de versions :

$ rpmdev-vercmp 2.0.14-22.el7_0 2.0.14.1-35.el7_6
2.0.14-22.el7_0 < 2.0.14.1-35.el7_6
php > var_dump(rpmvercmp('2.0.14-22.el7_0', '2.0.14.1-35.el7_6'));
int(-1)

Information sur un paquet / fichier :

$ rpm -qp remi-release-32.rpm
remi-release-32-1.fc32.remi.noarch
php > print_r(rpminfo("remi-release-32.rpm"));
Array
(
    [Name] => remi-release
    [Version] => 32
    [Release] => 1.fc32.remi
    [Summary] => Configuration pour le dépôt remi
    [Arch] => noarch
)

Avec plus de détails:

$ rpm -qip remi-release-32.rpm
Name        : remi-release
Version     : 32
Release     : 1.fc32.remi
Architecture: noarch
...
php > print_r(rpminfo("remi-release-32.rpm", true)); 
Array
(
    [Headeri18ntable] => Array
        (
            [0] => C
            [1] => fr
        )
    [Sigsize] => 16816
    [Sigpgp] => 89024604000108003016210434c10bdbcc6f1b252e50ba1a0714919e4c21a80805025e4a9fc7121c72656d694072656d697265706f2e6e6574000a09100714919e4c21a8084b950ffd1f8a2d25ea7561679beb7b78aca25da793b193b83fab23e48547d128b87114a80878f57321813b53cb45891730000533978f5c7c5342fd155767abfdc178ae99f9560a8789550fef143e24533dd068a7b6d32f9238609c4ac20d3f42e0d073c4230a3716a9a4273961f97c4731f199f092b6fb19a403058165c148d35c894f910a13808d0f317c8f93ed17bacbba2dc3a30623380f771253b4efcd6ef53d225e3fb32162d320bae520815fa135d357198c2fc9069dbbb4630ac2ee844c3be5ef825d93223d11eb3dd13606d4aedbd8bcb791c54cf6ca22205732a40b3a0b2108bdadcaee185f38c7782505cac2fa4bef0ca609dc0dc280bb53d5190f310e79f5fd0dd7929779b9c041eea3966573d26f588453105046cb9ab068ca32d0deb761104091fd291722cf5c8987d488149f02f1f6843b66603acb47a7abde32632368bfb77ddbfa609c7308708ca1e4455eab6e556de9e2e82e8b21c5ed54dc18565a535f73232d84d469ed6d1aa9d2fb5fc7f404d5631abea99c0e1e3c0b4e986615ec6c77779adf4a4fc0c24c835ce3a1fd03f63ef26f547bfca96d928a38c7701d60c8b2f204a487297407e8831c341c85034e0cc02f8a1282c5b2ee47ddf8bec7e9bdd6d79d8490758c871cd57d5ad6b6cb4859955ef3e13b75f2880106c1b6162fb237256bef2bd48521e5d728e18f06ad35eabdf2f3065e00c8cd1465d87d9d
    [Sigmd5] => 86dc03cedbebcc9a8a334763d642685a
    [Rsaheader] => 89024604000108003016210434c10bdbcc6f1b252e50ba1a0714919e4c21a80805025e4a9fc7121c72656d694072656d697265706f2e6e6574000a09100714919e4c21a808011a1000adfcd097e0268ebcbe71cb07059fcc1a2dd7fd48d6ad9526eede3dedc8c3ac9401681df0e2b43c9a6a5719b4b9490190159bad149c2acb40aa8cb9f07c294f599885ab046c605f5ad783c7a366d87c5e5d315415b812e97a2a7e615cea80f0b3b94fecb47f5cdf738ee1337e590f5f72c32a0d978ee2ad75cf220b67e7d54c096bb20c7012eb12d5a7827cffb2d4b4b71ea21753139ac3850fd5c56f876fb91754c9e69aacbe963b85d2a03be605cd35d9af64b4ac2781681fbfac56a224c7d57bb1e26bc3a6c3f98d2cc4057e29713756061f7db075841446e1a44ea35a278e64c4b562bfd4dff990fdfc7cf0b82148a0c61dfed3f3de2f199328d41c840078dca321978bee267b969574f98e946c13f14ee061a26b036253ea0f6f6036e8e0e289b0b7aebc87395477d40b2b0e7a84ed50e20552145b91168696392687dcd8e03a97317cd0047eb96689f59953adc4a1c9834f56498311110ab06789b269298ddc32a304e529be6bb8fb338ef91cecf48b146148da3b68f52f5dfbb14c73291fc02faf5c8427348fb105df23b38734e0d84c21ebccf0f39ecea363ddbf60543db419f93504e14a839f2243bb5b9f09be28a94c163f8a5e157546c431fddfe7c20fa86ec9729709eb8df7ef60003ea623ae1bd6421c02b98f329db827c3cc5447842f67ae23e49ba1d6118cb9a55b93f9bfb8bc3c46f3e465c5d537e1d13b20
    [Sha1header] => c528cb3308e69a4b9baa9a1e23a6541b06254f0a
    [Sha256header] => 9494000c44cf0665d12395631c21a90e4a44c4b7f37a8b3b1bbc798a0b99e1dd
    [Name] => remi-release
    [Version] => 32
    [Release] => 1.fc32.remi
...
    [Payloaddigestalgo] => 8
    [IsSource] =>
)

Beaucoup de champs sont disponibles (tous ceux fournit par la bibliothèque).

Information sur un paquet installé :

$ rpm -q kernel-5.5.8
kernel-5.5.8-200.fc31.x86_64
php > print_r(rpmdbinfo("kernel-5.5.8"));
Array
(
    [0] => Array
        (
            [Name] => kernel
            [Version] => 5.5.8
            [Release] => 200.fc31
            [Summary] => The Linux kernel
            [Arch] => x86_64
        )
)

Possibilité de fournir le nom, ou nom-version ou nom-version-release

Recherche :

Par nom

$ rpm -qa \*redis\*
redis-6.0~RC2-1.fc31.remi.x86_64
php-pecl-redis5-5.2.0-1.fc31.remi.7.3.x86_64
php > print_r(rpmdbsearch("*redis*", RPMTAG_NAME, RPMMIRE_GLOB));
Array
(
    [1] => Array
        (
            [Name] => redis
            [Version] => 6.0~RC2
            [Release] => 1.fc31.remi
            [Summary] => A persistent key-value database
            [Arch] => x86_64
        )
    [2] => Array
        (
            [Name] => php-pecl-redis5
            [Version] => 5.2.0
            [Release] => 1.fc31.remi.7.3
            [Summary] => Extension for communicating with the Redis key-value store
            [Arch] => x86_64
        )
)

Par fichier installé

$ rpm -qf $(which php)
php-cli-7.3.15-1.fc31.remi.x86_64
php > print_r(rpmdbsearch(PHP_BINARY, RPMTAG_INSTFILENAMES));
Array
(
    [0] => Array
        (
            [Name] => php-cli
            [Version] => 7.3.15
            [Release] => 1.fc31.remi
            [Summary] => Command-line interface for PHP
            [Arch] => x86_64
        )
)

Dépendances

$ rpm -q --whatprovides php-rpminfo
php-pecl-rpminfo-0.4.0-1.fc31.remi.7.3.x86_64
php > print_r(rpmdbsearch("php-rpminfo", RPMTAG_PROVIDES));
Array
(
    [0] => Array
        (
            [Name] => php-pecl-rpminfo
            [Version] => 0.4.0
            [Release] => 1.fc31.remi.7.3
            [Summary] => RPM information
            [Arch] => x86_64
        )
)

Et beaucoup d'autres critères, voir la liste des constantes RPMTAG_*.

Conclusion

Je pense que la majorité des fonctionnalités de recherche et d'information sur les RPM sont désormais disponible en PHP.

En attente de revue pour l'entrée dans les dépôts officiels de Fedora, voir la  revue #1812855.

N'hésitez pas à signaler tout dysfonctionnement, ou demander des évolutions.