Manuel Pear

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.

  1. <?php
  2. // @link http://pear.php.net/bugs/bug.php?id=12878
  3. //    Search for pear.conf inside /etc/pear/
  4.  
  5. require_once 'PEAR/Info.php';  
  6.  
  7. $pear_dir = '';  
  8. $user_file = '';  
  9. $syst_file = '/etc/pear/pear.conf';  
  10.  
  11. $info = new PEAR_Info($pear_dir, $user_file, $syst_file);  
  12. $info->display();  
  13.  
  14. ?> 

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.

  1. <?php
  2. require_once 'PEAR/Info.php';  
  3.  
  4. $info = new PEAR_Info();  
  5. $info->setStyleSheet(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'blueskin.css');  
  6. $info->display();  
  7.  
  8. ?> 

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 :

  1. <?php
  2. require_once 'PEAR/Info.php';  
  3.  
  4. $pear_dir = '';  
  5. $user_file = '';  
  6. $syst_file = '/opt/lampp/etc/pear.conf';  
  7. $options = array('channels' => array() );  
  8.  
  9. $info = new PEAR_Info($pear_dir, $user_file, $syst_file, $options);  
  10. $info->display();  
  11.  
  12. ?> 

Note : If you want to filter package listing from a channel list, then give the full qualified list; something like :

  1. <?php
  2. $options = array('channels' => array('pear.php.net', 'pear.phpunit.de', '__uri') );  
  3.  
  4. ?> 

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.

  1. <?php
  2. require_once 'PEAR/Info.php';  
  3.  
  4. $inst = PEAR_Info::packageInstalled('Role_Web', '1.1.0', 'pearified');  
  5. if ($inst === false) { 
  6.    echo 'sorry it seems that "pearified/Role_Web" package is not installed' 
  7.    . ' or version is less than 1.1.0';  
  8. }  
  9.  
  10. ?> 

Remonter Remonter
L'éditeur javascript - CSS - Gentoo - Tutoriaux PHP - Tutoriels PHP - Bretagne - php - Moto - Kit graphique