PHAR(1)
π NAME π
phar, phar.phar β the PHAR (PHP archive) command line tool. it's giving "whole app in one file" energy and honestly? obsessed. π
πΈ SYNOPSIS πΈ
phar <command> [options] ...
β¨ DESCRIPTION β¨
okay so, the PHAR file format is a way to squish entire PHP applications into a single file called a "phar" (PHP Archive) so distribution and installation are chef's kiss easy. π«Ά
with the phar command you can create, update or extract PHP archives. periodt.
the commands are: 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. yeet those files in there. π
Required arguments
-ffile β specifies the phar file to work on, bestie. that's the one you're touching....β any number of input files and directories. if-iis in use then ONLY files matching the given regular expression are being packed. and if-xis given then files matching that regular expression are NOT being packed. no cap.
Optional arguments
-aalias β provide an alias name for the phar file. cute lil nickname for it, slay.-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 just a selected entry. main character decision-making. β¨
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). don't forget the internal dir name, i'm begging.
π¦ delete command
delete entry from a PHAR archive. bye bye π
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. unpack that lil guy. π
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. very demure, very mindful. π
Optional arguments
...β optional command to retrieve help for.
β help-list command
lists available commands. the whole roster, bestie.
π§ 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. the receipts of what's inside.
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 form. 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. noted. π₯
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 being taken directly rather than being serialized. iykyk. π
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. this is the main event fr fr.
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 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 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 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. it's giving security gatekeeping. β¨
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 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 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. the full family tree, bestie. π³
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. a lil vibe check on your setup. π
π₯ COMPRESSION π₯
algorithms, bestie:
0β no compressionnoneβ no compressionautoβ automatically select compression algorithmgzβ GZip compressiongzipβ GZip compressionbz2β BZip2 compressionbzip2β BZip2 compression
π HASH π
algorithms, also bestie:
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: https://www.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
(if you find a bug, that's not a you problem, but please do tell them, bestie π)
π 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: https://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. ππ literally everyone ate.
πΈ VERSION INFORMATION πΈ
this manpage describes phar, version 8.4.27.
π 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.
okay that's the whole page bestie, no skips, no gatekeeping π
this is The PHP Group's phar lib, dated 2024 β go forth and archive, you absolute icon πβ¨
π¦ where this page comes from
- debian trixie: php8.4-cli 8.4.27-1~deb13u1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms