phar, phar.phar - PHAR (PHP archive) command line tool
Contents
Add Command
Add entries to a PHAR package.
Required arguments:
-ffile 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:
-aalias Provide an alias name for the phar file.
-calgo Compression algorithm (see COMPRESSION )
-iregex Specifies a regular expression for input files.
-llevel Number of preceding subdirectories to strip from file entries
-xregex Regular expression for input files to exclude.
Bugs
You can view the list of known bugs or report any new bug you found at:
http://bugs.php.netCompress Command
Compress or uncompress all files or a selected entry.
Required arguments:
-calgo Compression algorithm (see COMPRESSION )
-ffile Specifies the phar file to work on.
Optional arguments:
-eentry Name of entry to work on (must include PHAR internal directory name if any).
Compression
Algorithms:
0 No compression
none No compression
auto Automatically select compression algorithm
gz GZip compression
gzip GZip compression
bz2 BZip2 compression
bzip2 BZip2 compression
Copyright
Copyright © The PHP Group
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:
https://www.php.net/license/3_01.txt
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.
The PHP Group 2021 PHAR(1)
Delete Command
Delete entry from a PHAR archive
Required arguments:
-eentry Name of entry to work on (must include PHAR internal directory name if any).
-ffile Specifies the phar file to work on.
Description
The PHAR file format provides a way to put entire PHP applications into a single file called a "phar"
(PHP Archive) for easy distribution and installation.
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
Extract Command
Extract a PHAR package to a directory.
Required arguments:
-ffile Specifies the phar file to work on.
Optional arguments:
-iregex Specifies a regular expression for input files.
-xregex Regular expression for input files to exclude.
... Directory to extract to (defaults to '.').
Hash
Algorithms:
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
Help Command
This help or help for a selected command.
Optional arguments:
... Optional command to retrieve help for.
Help-List Command
Lists available commands.
Info Command
Get information about a PHAR package.
By using -k it is possible to return a single value.
Required arguments:
-ffile Specifies the phar file to work on.
Optional arguments:
-kindex Subscription index to work on.
List Command
List contents of a PHAR archive.
Required arguments:
-ffile Specifies the phar file to work on.
Optional arguments:
-iregex Specifies a regular expression for input files.
-xregex Regular expression for input files to exclude.
Meta-Del Command
Delete meta information of a PHAR entry or a PHAR package.
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:
-ffile Specifies the phar file to work on.
Optional arguments:
-eentry Name of entry to work on (must include PHAR internal directory name if any).
-kindex Subscription index to work on.
Meta-Get Command
Get meta information of a PHAR entry or a PHAR package in serialized from. If no output file is specified
for meta data then stdout is being used. You can also specify a particular index using -k. In that case
the metadata is expected to be an array and the value of the given index is returned using echo rather
than using serialize. If that index does not exist or no meta data is present then the return value is 1.
Required arguments:
-ffile Specifies the phar file to work on.
Optional arguments:
-eentry Name of entry to work on (must include PHAR internal directory name if any).
-kindex Subscription index to work on.
Meta-Set Command
Set meta data of a PHAR entry or a PHAR package using serialized input. If no input file is specified for
meta data then stdin is being used. You can also specify a particular index using -k. In that case the
metadata is expected to be an array and the value of the given index is being set. If the metadata is
not present or empty a new array will be created. If the metadata is present and a flat value then the
return value is 1. Also using -k the input is been taken directly rather then being serialized.
Required arguments:
-ffile Specifies the phar file to work on.
-mmeta Meta data to store with entry (serialized php data).
Optional arguments:
-eentry Name of entry to work on (must include PHAR internal directory name if any).
-kindex Subscription index to work on.
Name
phar, phar.phar - PHAR (PHP archive) command line tool
Pack Command
Pack files into a PHAR archive.
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:
-ffile 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:
-aalias Provide an alias name for the phar file.
-bbang Hash-bang line to start the archive (e.g. #!/usr/bin/php). The hash mark itself '#!' and
the newline character are optional.
-calgo Compression algorithm (see COMPRESSION )
-hhash Selects the hash algorithm (see HASH )
-iregex Specifies a regular expression for input files.
-llevel Number of preceding subdirectories to strip from file entries
-ploader 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.
-sstub Select the stub file.
-xregex Regular expression for input files to exclude.
-ykey Private key for OpenSSL signing.
See Also
For a more or less complete description of PHAR look here:
http://php.net/pharSign Command
Set signature hash algorithm.
Required arguments:
-ffile Specifies the phar file to work on.
-hhash Selects the hash algorithm (see HASH )
Optional arguments:
-ykey Private key for OpenSSL signing.
Stub-Get Command
Get the stub of a PHAR file. If no output file is specified as stub then stdout is being used.
Required arguments:
-ffile Specifies the phar file to work on.
Optional arguments:
-sstub Select the stub file.
Stub-Set Command
Set the stub of a PHAR file. If no input file is specified as stub then stdin is being used.
Required arguments:
-ffile Specifies the phar file to work on.
Optional arguments:
-bbang Hash-bang line to start the archive (e.g. #!/usr/bin/php). The hash mark itself '#!' and
the newline character are optional.
-ploader 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.
-sstub Select the stub file.
Synopsis
phar <command> [options] ...
Tree Command
Get a directory tree for a PHAR archive.
Required arguments:
-ffile Specifies the phar file to work on.
Optional arguments:
-iregex Specifies a regular expression for input files.
-xregex Regular expression for input files to exclude.
Version Command
Get information about the PHAR environment and the tool version.
Version Information
This manpage describes phar, version 8.1.2-1ubuntu2.22.
