FAQ
PEAR_Info FAQ
- What does it cost ?
- Do you offer support ?
- I found a bug, what shall I do ?
- What is PEAR ?
- I want to display my system configuration, but this one is not detected ?
- I want to change the look an feel (colors) of PEAR_Info output ?
- I want to display packages from all my channels ?
- I want to check if a package is installed or not ?
- What does it cost ?
-
You can download and use it for free. But don't delete the copyright notice. You can read terms of the PHP license.
- Do you offer support ?
-
YES if there is no answer in this Guide and if you are ready to share some informations such as : your configuration (platform Win *nix mac, PHP version, PEAR packages installed) and perharps your script.
- I found a bug, what shall I do ?
-
You can report it with the bug tracker at PEAR.
- What is PEAR ?
-
PEAR (an acronym for PHP Extension and Application Repository) is a framework and distribution system for reusable PHP components.
Don't forget to read also the PEAR Руководство and PEAR FAQ.
- I want to display my system configuration, but this one is not detected ?
-
If your system file (see command pear config-show) does not exists, or is locate in another directory, then you should give this information on PEAR_Info class constructor.
<?php
// @link http://pear.php.net/bugs/bug.php?id=12878
// Search for pear.conf inside /etc/pear/
require_once 'PEAR/Info.php';
$pear_dir = '';
$user_file = '';
$syst_file = '/etc/pear/pear.conf';
$info = new PEAR_Info($pear_dir, $user_file, $syst_file);
$info->display();
?>
- I want to change the look an feel (colors) of PEAR_Info output ?
-
First copy the default stylesheet named
pearinfo.css
(locate in{data_dir}/PEAR_Info
: see command pear config-show) as a pattern. Then second, change colors and whatever you want until you keep all CSS selectors.See for example the blue layout pattern skin locate in package installation under name
{doc_dir}/PEAR_Info/examples/blueskin.css
.Last, as
{doc_dir}/PEAR_Info/examples/pear_info2.php
script, set the new stylesheet withPEAR_Info::setStyleSheet
.<?php
require_once 'PEAR/Info.php';
$info = new PEAR_Info();
$info->setStyleSheet(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'blueskin.css');
$info->display();
?>
- I want to display packages from all my channels ?
-
By default PEAR_Info display only informations from
pear.php.net
channel.To remove this limit, give as option to the class constructor an empty channels list, as below :
<?php
require_once 'PEAR/Info.php';
$pear_dir = '';
$user_file = '';
$syst_file = '/opt/lampp/etc/pear.conf';
$options = array('channels' => array() );
$info = new PEAR_Info($pear_dir, $user_file, $syst_file, $options);
$info->display();
?>If you want to filter package listing from a channel list, then give the full qualified list; something like :
<?php
$options = array('channels' => array('pear.php.net', 'pear.phpunit.de', '__uri') );
?>
- I want to check if a package is installed or not ?
-
With static method
PEAR_Info::packageInstalled
, you can check installation of a package from all channels declared, and also filter by version.<?php
require_once 'PEAR/Info.php';
$inst = PEAR_Info::packageInstalled('Role_Web', '1.1.0', 'pearified');
if ($inst === false) {
echo 'sorry it seems that "pearified/Role_Web" package is not installed'
. ' or version is less than 1.1.0';
}
?>