Writing/Generating the package.xml

The package.xml can be generated using the pfm tool or in your favourite text editor. It's your call really.

The pfm tool can be installed via:

$pear install PEAR_PackageFileManager_Cli

Creating package.xml Using PFM

pfm is a commandline tool that analyses the contents of a project directory and creates a package.xml describing what it has found. Because we don't want to install any project specific files we're going to cheat in order to keep the generated package.xml as small as possible.

Begin by creating an empty directory and then moving into it:

kguest:~$ cd MyProject-packages

then create an empty php file:

kguest:~/MyProject-packages$ touch empty.php

Download and save this package.xml into this new directory; then run pfm.

kguest:~/MyProject-packages$ wget package.xml
kguest:~/MyProject-packages$ pfm

PEAR Package File Manager Command Line Tool

Please enter the location of your package [.]*:<press enter>

Enter the base install directory

1) /dev/null

Please choose an option: 1

PEAR Package File Manager Command Line Tool

1. Package name                 [MyProject_Packages]
2. Channel/URI                  [URI: file:///MyProject-packages/package.xml]
3. Summary                      [this is a wrapper package for install...]
4. Description                  [<none>]
5. Maintainers
6. Version                      [Release: 0.0.1 API: 0.0.1]
7. Stability                    [Release: alpha API: alpha]
8. License                      [LGPL]
9. Notes                        [<none>]
10. Dependencies
11. Tasks
12. Regenerate contents
13. Echo package file to stdout
14. Save & Quit
15. Quit without saving          (ctrl-c)

Please choose an option from the menu: 10

Edit Dependencies

1. Return to main menu

2. Add new dependency
3. Clear all dependencies

4. Change PHP >= 5.2.1
5. Change PEAR Installer >= 1.8.0


Please choose an option from the menu: 2

Dependency type [pkg] (pkg,ext,php,prog,os,sapi,zend)*: pkg

Dependency name*: PHP_CodeSniffer

Is the dependency (o)ptional or (r)equired [r] (o,r)*: r

Package type (c)hannel or (u)ri [c] (c,u)*: c

Dependency channel [pear.php.net]*:

Minimum version: 1.2.0RC1

Maximum version:

Edit Dependencies

1. Return to main menu

2. Add new dependency
3. Clear all dependencies

4. Change PHP >= 5.2.1
5. Change PEAR Installer >= 1.8.0


Required Package dependency "PHP_CodeSniffer" - pear.php.net

Repeat this as required until all packages that you want to be managed have been added; then return to the main menu, save and quit. Naturally, you should also use pfm to change the name of the project described by package.xml to something of your choosing.

Creating package.xml Using Text Editor

Download the package.xml file from above. Use this as a template and refer to the tag reference for version 2 of package.xml in the developers section for details of how to add dependencies to the file.