PEAR_Info::packageInstalled

PEAR_Info::packageInstalled() – Check if a package is installed

Synopsis

require_once 'PEAR/Info.php';

boolean PEAR_Info::packageInstalled ( string $name , string $version = null , string $channel = null , string $user_file = '' , string $system_file = '' )

Description

Simple function to check if a package is installed under user or system PEAR installation. Minimal version and channel info are supported.

Parameter

string $name

Package name

string $version

(optional) The minimal version that should be installed

string $channel

(optional) The package channel distribution

string $user_file

(optional) file to read PEAR user-defined options from

string $system_file

(optional) file to read PEAR system-wide defaults from

Since

since version 1.6.0 (2005-01-03)

Throws

throws no exceptions thrown

Note

This function should be called statically.

Example

<?php
require_once 'PEAR/Info.php';

$res PEAR_Info::packageInstalled('Role_Web''1.1.0''pearified');
if (
$res) {
    print 
"Package pearified/Role_Web 1.1.0 or greater is installed \n";
} else {
    print 
"Package pearified/Role_Web is not yet installed \n";
}

$res PEAR_Info::packageInstalled('PEAR_PackageFileManager');
if (
$res) {
    print 
"Package pear/PEAR_PackageFileManager is installed \n";
} else {
    print 
"Package pear/PEAR_PackageFileManager is not yet installed \n";
}
?>