JavaScript Editor Javascript validator     Web page editor 



FAQ

FAQ -- Answers to most Frequently Asked Questions

PEAR_Info FAQ

1. General questions
1.1. What does it cost ?
1.2. Do you offer support ?
1.3. I found a bug, what shall I do ?
1.4. What is PEAR ?
2. How to
2.1. I want to display my system configuration, but this one is not detected ?
2.2. I want to change the look an feel (colors) of PEAR_Info output ?
2.3. I want to display packages from all my channels ?
2.4. I want to check if a package is installed or not ?

1. General questions

1.1. 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.

1.2. 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.

1.3. I found a bug, what shall I do ?

You can report it with the bug tracker at PEAR.

1.4. 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 Manual and PEAR FAQ.

2. How to

2.1. 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();
?>

2.2. 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 with PEAR_Info::setStyleSheet.
<?php
require_once 'PEAR/Info.php';

$info = new PEAR_Info();
$info->setStyleSheet(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'blueskin.css');
$info->display();
?>

2.3. 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();
?>

Note: 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') );
?>

2.4. 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';
}
?>




JavaScript Editor Javascript validator     Web page editor