PHAR(1)
β¨ NAME β¨
phar, phar.phar β the PHAR (PHP archive) command line tool, bestie π
πΈ SYNOPSIS πΈ
phar <command> [options] ...
π DESCRIPTION π
okay so picture this: the PHAR file format is literally a way to shove entire PHP applications into one single file called a "phar" (PHP Archive) so distribution and installation are, like, effortless. no cap. π«Ά
with the phar command you can create, update or extract PHP archives. that's the whole vibe.
Commands, in order, no skips: add compress delete extract help help-list info list meta-del meta-get meta-set pack sign stub-get stub-set tree version π¦
π add command π
Add entries to a PHAR package. it's giving "let me in."
Required arguments:
-ffile β Specifies the phar file to work on....β Any number of input files and directories. If-iis in use then ONLY files and matching the given regular expression are being packed. If-xis 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.
π§ compress command π§
Compress or uncompress all files or a selected entry. glow up or glow down, your call π
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).
π delete command π
Delete entry from a PHAR archive. bye bestie, we don't know her anymore π
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.
π¦ extract command π¦
Extract a PHAR package to a directory. unpacking, main character energy π
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'.').
π«Ά help command π«Ά
This help or help for a selected command. ask and you shall receive, fr fr.
Optional arguments:
...β Optional command to retrieve help for.
β¨ help-list command β¨
Lists available commands. the whole roster, the whole squad π
π 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. show me what you're working with.
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. (0 = slay, 1 = nothing was there π)
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.
π 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-iis in use then ONLY files and matching the given regular expression are being packed. If-xis 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 ofPHP_Archiveclass file (pear list-files PHP_Archive). You can use'0'or'1'to locate it automatically using the mentionedpearcommand. 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 classPHP_Archivegets registered asphar://stream wrapper if necessary. And finally this switch will add the filephar.incfrom this package and load it to ensure classPharis present.-sstub β Select the stub file.-xregex β Regular expression for input files to exclude.-ykey β Private key for OpenSSL signing.
π sign command π
Set signature hash algorithm. signing off, literally βοΈ
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 ofPHP_Archiveclass file (pear list-files PHP_Archive). You can use'0'or'1'to locate it automatically using the mentionedpearcommand. 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 classPHP_Archivegets registered asphar://stream wrapper if necessary. And finally this switch will add the filephar.incfrom this package and load it to ensure classPharis present.-sstub β Select the stub file.
π³ tree command π³
Get a directory tree for a PHAR archive. family tree but make it files.
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. vibe check, but for the tool.
π COMPRESSION π
Algorithms:
0β No compressionnoneβ No compressionautoβ Automatically select compression algorithmgzβ GZip compressiongzipβ GZip compressionbz2β BZip2 compressionbzip2β BZip2 compression
π HASH π
Algorithms:
md5β MD5sha1β SHA1sha256β SHA256sha512β SHA512opensslβ OpenSSL using SHA-1openssl_sha256β OpenSSL using SHA-256openssl_sha512β OpenSSL using SHA-512
π SEE ALSO π
For a more or less complete description of PHAR look here: http://php.net/phar
π BUGS π
You can view the list of known bugs or report any new bug you found at: https://github.com/php/php-src/issues
bestie if something's broken, tell the maintainers, not me. i just write the vibes π
π AUTHORS π
The PHP Group: Thies C. Arntzen, Stig Bakken, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski.
Work for the PHP archive was done by Gregory Beaver, Marcus Boerger.
A List of active developers can be found here: http://www.php.net/credits.php
And last but not least PHP was developed with the help of a huge amount of contributors all around the world. icons, every single one of them π«Ά
π¦ VERSION INFORMATION π¦
This manpage describes phar, version 8.3.6.
π 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.
and that's the whole page, bestie β brought to you by The PHP Group, dated 2024, filed under PHAR(1). go forth and archive responsibly π β¨
π¦ where this page comes from
- ubuntu noble: php8.3-cli 8.3.6-0maysync1
- ubuntu noble: php8.3-cli 8.3.6-0ubuntu0.24.04.11
- ubuntu noble: php8.3-cli 8.3.6-0ubuntu0.24.04.13
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms