The PEAR package manager (pear) is the swiss-army tool for:

And the cool thing is that it is (most likely) already installed on your system (PHP version 4.3.0 or newer).

It is also smart, it groks XML-RPC (like when talking to PEAR's or Horde's site), HTTP (when using a full URL), or even a local tarball on your disk.

... and if you do not have it
 $ wget http://pear.php.net/go-pear
 $ php -f go-pear
 (... follow the instructions ...)