Skip to content

pantr as PEAR installer

pago edited this page Sep 14, 2010 · 1 revision

pantr can be used as a project-based PEAR installer. This means you can install and manage PEAR dependencies locally for every project instead of installing them as global packages. For example pantr includes the pgs/util, pgs/parser and pgs/cli libraries without cluttering
your global PEAR configuration.

You do not have to have a pantrfile to use this functionality.

To setup a local pear repository, use the pear:init task

$ pantr pear:init lib

The last argument is the directory in which PEAR dependencies will be installed. Using the above command will install it in the lib directory (which is the default thus you theoretically don’t need to provide it).

Change into the specified directory (which was created if it didn’t exist before) and start using your local pear repository:

$ pantr pear:channel-discover pear.pagosoft.com
$ pantr pear:install pgs/parser

and so on.

Since version 0.7.0 pantr supports handling your PEAR dependencies in a much nicer way. Instead of issuing a pear command from the command line you can specify your PEAR dependencies in the pantrfile and pantr will sync it automatically, thus removing obsolete and installing new packages.

pantr::dependencies()->in('lib')
	->fromChannel('pear.pagosoft.com')
		->usePackage('util')
		->usePackage('cli')
		->usePackage('parser')
	->fromChannel('pear.php-tools.net')
		->usePackage('vfsstream', 'alpha')
	->fromChannel('pear.symfony-project.com')
		->usePackage('yaml')
	->sync();

It is up to you to either use it as a task (invoked manually) or put at the beginning/end of your pantrfile (always invoked when pantr is run).
The preferred way is to include it in a task.

Clone this wiki locally