With the phar command you can create, update or extract PHP archives.
Commands: add compress delete extract help help-list info list meta-del meta-get meta-set pack sign stub-get stub-set tree version
Required arguments:
15
-f file Specifies the phar file to work on.
... Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.
Optional arguments:
15
-a alias Provide an alias name for the phar file.
-c algo Compression algorithm (see COMPRESSION )
-i regex Specifies a regular expression for input files.
-l level Number of preceding subdirectories to strip from file entries
-x regex Regular expression for input files to exclude.
Required arguments:
15
-c algo Compression algorithm (see COMPRESSION )
-f file Specifies the phar file to work on.
Optional arguments:
15
-e entry Name of entry to work on (must include PHAR internal directory name if any).
Required arguments:
15
-e entry Name of entry to work on (must include PHAR internal directory name if any).
-f file Specifies the phar file to work on.
Required arguments:
15
-f file Specifies the phar file to work on.
Optional arguments:
15
-i regex Specifies a regular expression for input files.
-x regex Regular expression for input files to exclude.
... Directory to extract to (defaults to '.').
Optional arguments:
15
... Optional command to retrieve help for.
By using -k it is possible to return a single value.
Required arguments:
15
-f file Specifies the phar file to work on.
Optional arguments:
15
-k index Subscription index to work on.
Required arguments:
15
-f file Specifies the phar file to work on.
Optional arguments:
15
-i regex Specifies a regular expression for input files.
-x regex Regular expression for input files to exclude.
If -k is given then the metadata is expected to be an array and the given index is being deleted.
If something was deleted the return value is 0 otherwise it is 1.
Required arguments:
15
-f file Specifies the phar file to work on.
Optional arguments:
15
-e entry Name of entry to work on (must include PHAR internal directory name if any).
-k index Subscription index to work on.
Required arguments:
15
-f file Specifies the phar file to work on.
Optional arguments:
15
-e entry Name of entry to work on (must include PHAR internal directory name if any).
-k index Subscription index to work on.
Required arguments:
15
-f file Specifies the phar file to work on.
-m meta Meta data to store with entry (serialized php data).
Optional arguments:
15
-e entry Name of entry to work on (must include PHAR internal directory name if any).
-k index Subscription index to work on.
When using -s <stub>, then the stub file is being excluded from the list of input files/dirs.To create an archive that contains PEAR class PHP_Archive then point -p argument to PHP/Archive.php.
Required arguments:
15
-f file Specifies the phar file to work on.
... Any number of input files and directories. If -i is in use then ONLY files and matching the given regular expression are being packed. If -x is given then files matching that regular expression are NOT being packed.
Optional arguments:
15
-a alias Provide an alias name for the phar file.
-b bang Hash-bang line to start the archive (e.g. #!/usr/bin/php). The hash mark itself '#!' and the newline character are optional.
-c algo Compression algorithm (see COMPRESSION )
-h hash Selects the hash algorithm (see HASH )
-i regex Specifies a regular expression for input files.
-l level Number of preceding subdirectories to strip from file entries
-p loader Location of PHP_Archive class file (pear list-files PHP_Archive).You can use '0' or '1' to locate it automatically using the mentioned pear command. When using '0' the command does not error out when the class file cannot be located. This switch also adds some code around the stub so that class PHP_Archive gets registered as phar:// stream wrapper if necessary. And finally this switch will add the file phar.inc from this package and load it to ensure class Phar is present.
-s stub Select the stub file.
-x regex Regular expression for input files to exclude.
-y key Private key for OpenSSL signing.
Required arguments:
15
-f file Specifies the phar file to work on.
-h hash Selects the hash algorithm (see HASH )
Optional arguments:
15
-y key Private key for OpenSSL signing.
Required arguments:
15
-f file Specifies the phar file to work on.
Optional arguments:
15
-s stub Select the stub file.
Required arguments:
15
-f file Specifies the phar file to work on.
Optional arguments:
15
-b bang Hash-bang line to start the archive (e.g. #!/usr/bin/php). The hash mark itself '#!' and the newline character are optional.
-p loader Location of PHP_Archive class file (pear list-files PHP_Archive).You can use '0' or '1' to locate it automatically using the mentioned pear command. When using '0' the command does not error out when the class file cannot be located. This switch also adds some code around the stub so that class PHP_Archive gets registered as phar:// stream wrapper if necessary. And finally this switch will add the file phar.inc from this package and load it to ensure class Phar is present.
-s stub Select the stub file.
Required arguments:
15
-f file Specifies the phar file to work on.
Optional arguments:
15
-i regex Specifies a regular expression for input files.
-x regex Regular expression for input files to exclude.
15
0 No compression
none No compression
auto Automatically select compression algorithm
gz GZip compression
gzip GZip compression
bz2 BZip2 compression
bzip2 BZip2 compression
15
md5 MD5
sha1 SHA1
sha256 SHA256
sha512 SHA512
openssl OpenSSL using SHA-1
openssl_sha256 OpenSSL using SHA-256
openssl_sha512 OpenSSL using SHA-512
0
https://www.php.net/phar
1
0
https://github.com/php/php-src/issues
1
Work for the PHP archive was done by Gregory Beaver, Marcus Boerger.
A List of active developers can be found here:
0
https://www.php.net/credits.php
1
And last but not least PHP was developed with the help of a huge amount of contributors all around the world.
This source file is subject to version 3.01 of the PHP license, that is bundled with this package in the file LICENSE, and is available through the world-wide-web at the following url:
0
https://www.php.net/license/3_01.txt
1
If you did not receive a copy of the PHP license and are unable to obtain it through the world-wide-web, please send a note to license@php.net so we can mail you a copy immediately.