Channels are alternative package sources. See the channel section of the manual for more information.
What you need to know now: By using channels, you can install packages that are not part of PEAR. Prominent PHP projects like Horde and PHPUnit distribute their software through PEAR-compatible channels.
Before you can use a channel, your pear installation needs to know about it. This process is called "channel discovery".
Once you know the project's channel url, just type:
$ pear channel-discover http://pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Downloading a channel.xml file, you can add a channel just using that file using channel-add:
$ pear channel-add my-channel.xml
Using list-channels, you can get an overview of known channels:
$ pear list-channels
components.ez.no eZ Enterprise components
demochanserv.bogo Simple demo channel server
gnope.org PHP-Gtk2 applications
pear.chiaraquartet.net Chiara Testing Channel
pear.phing.info Channel for Phing build tool releases
pear.php.net PHP Extension and Application Repository
pear.phpunit.de PHPUnit channel server
pear.symfony-project.com symfony project PEAR channel
pearified.com PEAR-Compatible Extension and Application
pecl.php.net PHP Extension Community Library
__uri Pseudo-channel for static packages
More insight about a channel can be gotten with channel-info. It prints out a description, the channel's shortcut name (alias) as well as mirror information.
$ pear channel-info pear.php.net
Channel pear.php.net Information:
Name and Server pear.php.net
Summary PHP Extension and Application Repository
When installing or doing anything else with a package that is not in your default channel, you need to specify the channel by full name or alias:
$ pear install gnope/Dev_Inspector
... installation of package "Dev_Inspector" in channel "gnope"
$ pear list -c pear.phpunit.de
Installed packages, channel pear.phpunit.de:
Package Version State
PHPUnit 3.2.5 stable
General rule is that when you would specify a package name, use $channel/$packagename now. All other functions with channel support have a -c option to specify the channel name or alias.
PEAR compatible channels can be password protected. You could use this to e.g. distribute custom proprietary software to your clients, and don't want to publicy publish those packages anywhere.
Password protection is done via a HTTP Basic Authentication (.htaccess and .htpassword on Apache). When trying to discover such a password protected channel, you will get a message like this:
$ pear channel-discover pear.company.com
Discovery of channel "pear.company.com" failed
(channel-add: Cannot open "http://pear.company.com/channel.xml"
(File http://pear.company.com:80/channel.xml not valid
(received: HTTP/1.1 401 Authorization Required
In this case, download the channel.xml file manually, for example with your browser or wget. A channel.xml is always in the root directory of the channel server. After that, discover the channel with the saved file:
$ pear channel-add /path/to/saved/channel.xml
Adding Channel "pear.company.com" succeeded
Now the PEAR manager needs to know about the channel's username and password. We tell him by using set-config in connection with the channel option:
$ pear config-set -c pear.company.com username johndoe
$ pear config-set -c pear.company.com password secret
Now test if we did everything right by showing available packages on the channel:
$ pear list-all -c pear.company.com
All packages [Channel pear.company.com]:
Package Latest Local
comp/WorldDominator 0.8.1 Tool to dominate the world
Note: If you changed your creditentials, you should issue a pear clear-cache command to make sure that the installer does not use cached data.