Usage

Usage of the pharext packager to create extension PHARs.

Installation

Composer

$ composer require --dev m6w6/pharext
Invocation
$ ./vendor/bin/pharext

Source clone

$ git clone github.com:m6w6/pharext
$ git checkout v3.0.0
Invocation
$ ./bin/pharext
Rebuilding

The bin/pharext binary should be up-to-date, but if you want to rebuild, issue:

$ make

Note, that this will create an unsigned binary, with the version string reset to @dev-master.

Display the help message

$ ./bin/pharext --help

Yields:

pharext v@dev-master (c) Michael Wallner <mike@php.net>

Usage:

$ ./bin/pharext [-hvqgpzZE] -n <arg> -r <arg> -s <arg> [-b|-d|-S <arg>]

   -h|--help                Display this help
   -v|--verbose             More output
   -q|--quiet               Less output
   -n|--name <arg>          Extension name (REQUIRED)
   -r|--release <arg>       Extension release version (REQUIRED)
   -s|--source <arg>        Extension source directory (REQUIRED)
   -g|--git                 Use `git ls-tree` to determine file list
   -b|--branch <arg>        Checkout this tag/branch
   -p|--pecl                Use PECL package.xml to determine file list, name and release
   -d|--dest <arg>          Destination directory [.]
   -z|--gzip                Create additional PHAR compressed with gzip
   -Z|--bzip                Create additional PHAR compressed with bzip
   -S|--sign <arg>          Sign the PHAR with a private key
   -E|--zend                Mark as Zend Extension
   --signature              Show pharext signature
   --license                Show pharext license
   --version                Show pharext version

Switches explained

Output

Use -v or --verbose, if you want to see more (diagnostic) output, like what files are packaged.

Use -q or --quiet, if you want to see practically no output, unless any error occurs.

Extension name

Use -n or --name, if you do not provide a pharext_package.php script or a PECL package.xml v2 in the root of the extension source directory.

An argument fot this option is required.

Release version

Use -r or --release, if you do not provide a pharext_package.php script or a PECL package.xml v2 in the root of the extension source directory.

An argument fot this option is required.

Source location

Use -s or --source, to specify the root directory of the extension’s sources.

An argument to this option is required.

The directory should either be part of a git tree (also, specify --git) or should have a PECL package.xml (v2 or later; also, specify --pecl) or should have a pharext_package.php hook script.

Git repositories

Use -g or --git, if the source directory is part of a git tree. The files that should be packaged are determined by running git ls-tree -r HEAD.

PECL packages

Use -p or --pecl, if a package.xml (v2 or later) is located in the root of the source directory. The package.xml will provide the extension’s name, the extension’s release version, any additional configure switches and the files needed to package up the PHAR.

Output destination

Use -d or --dest, if you want the resulting PHAR package to be put into another location than the current working directory.

An argument to this option is required.

Output compression

Use -z or --gzip, to additionally create a gzipped PHAR.

Use -Z or --bzip, to additionally create a PHAR compressed by bzip2.

Signing with a private key

Use -S or --sign, if you want to sign the resulting PHAR with a private key. The argument should point to your private key in PEM format. The OpenSSL extension is required to perform this action.

An argument to this option is required.

Note that you’ll have to distribute the public key with your package for users to be able to run the installer.

Dump pharext signature

Use --signature, to display the PHAR signature of pharext.

If this is a development build, you’ll get a SHA-1 checksum:

SHA-1 signature of ./bin/pharext
47E08DB9EFF11794E2DE5B87072783D9FB1779F3

If this is a release build, you should get something similar to:

OpenSSL signature of ./bin/pharext
1AA183B282527500AD0BA37E7A55F6B0056AC25A232C99137FA8442227FBBE46
E6DB9FE4FB6F597D90299D21596B9D1194D2EF1FEF78D9C3301995D188CFDE91
212F475C6FC6DF33865A9AB028D2042A4D2842F4FF16A2BC65660DE64888B1BC
7F76DF9783090F84CB2B8674E02AF95210B16B9705AAD9A3A367692E2ADD8703
98A4508B6A4160F3D45389CB813F8DA0284567C21EEC4EE6E9F89D80B8982493
5142B002A7E00AB399C1C24AA9FF18D3FEB1F4C2AF16689366FC17DE8803C357
6EC7E50A9F02DD566A84062C2805AFC5BA27F5420F56F1F98BCB334CC894519F
92CAC77E82A3E0F49EAAAE9A7E3B6D17881A0E5BC1393A3C682B0C61839D4129

Please refer to the releases page for signature verification.