PHAR(1)
π NAME π
okay so bestie, meet phar and phar.phar β literally the PHAR (PHP archive) command line tool, no cap π
β¨ SYNOPSIS β¨
phar <command> [options] ...
πΈ DESCRIPTION πΈ
The PHAR file format is the moment where you can put entire PHP applications into one single file, and that file is called a "phar" (PHP Archive) β for easy distribution and installation π«Ά
With the phar command you can create, update or extract PHP archives. iconic behavior, frankly.
Commands, in order: 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 "put stuff in the box" π
Required arguments:
-f fileβ tells us which phar file we're working on....β any number of input files and directories. ngl, 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. very "you're either in the group chat or you're not" π
Optional arguments:
-a aliasβ provide an alias name for the phar file.-c algoβ compression algorithm (go look at 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.
π compress command
Compress or uncompress all files, or just a selected entry. glow-up or un-glow-up your files, your call β¨
Required arguments:
-c algoβ compression algorithm (see COMPRESSION).-f fileβ specifies the phar file to work on.
Optional arguments:
-e entryβ name of entry to work on (must include PHAR internal directory name if any). yes bestie, the whole path, don't play π
π¦ delete command
Delete entry from a PHAR archive. bye bitch, respectfully π
Required arguments:
-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.
π§ extract command
Extract a PHAR package to a directory. unpacking the whole vibe π
Required arguments:
-f fileβ specifies the phar file to work on.
Optional arguments:
-i regexβ specifies a regular expression for input files.-x regexβ regular expression for input files to exclude....β directory to extract to (it defaults to'.').
π help command
This help, or help for a selected command. so meta of it π
Optional arguments:
...β optional command to retrieve help for.
β help-list command
Lists available commands. the roster, periodt π
π info command
Get information about a PHAR package.
By using -k it is possible to return a single value. lowkey the best party trick.
Required arguments:
-f fileβ specifies the phar file to work on.
Optional arguments:
-k indexβ subscription index to work on.
πΈ list command
List contents of a PHAR archive. what's inside? let's find out π«Ά
Required arguments:
-f fileβ specifies the phar file to work on.
Optional arguments:
-i regexβ specifies a regular expression for input files.-x regexβ 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. highkey important, don't ignore the exit code bestie.
Required arguments:
-f fileβ specifies the phar file to work on.
Optional arguments:
-e entryβ name of entry to work on (must include PHAR internal directory name if any).-k indexβ 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. yes, we're checking the vibe of your return codes too π
Required arguments:
-f fileβ specifies the phar file to work on.
Optional arguments:
-e entryβ name of entry to work on (must include PHAR internal directory name if any).-k indexβ 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 taken directly rather than being serialized. the way that worksβ¦ obsessed π
Required arguments:
-f fileβ specifies the phar file to work on.-m metaβ meta data to store with entry (serialized php data).
Optional arguments:
-e entryβ name of entry to work on (must include PHAR internal directory name if any).-k indexβ subscription index to work on.
π pack command
Pack files into a PHAR archive. the main character command 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 the -p argument to PHP/Archive.php.
Required arguments:
-f fileβ 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:
-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 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.-s stubβ select the stub file.-x regexβ regular expression for input files to exclude.-y keyβ private key for OpenSSL signing.
π sign command
Set signature hash algorithm. cryptographic slay π
Required arguments:
-f fileβ specifies the phar file to work on.-h hashβ selects the hash algorithm (see HASH).
Optional arguments:
-y keyβ 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:
-f fileβ specifies the phar file to work on.
Optional arguments:
-s stubβ 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:
-f fileβ specifies the phar file to work on.
Optional arguments:
-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 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.-s stubβ select the stub file.
π tree command
Get a directory tree for a PHAR archive. it's giving family tree but for files π³
Required arguments:
-f fileβ specifies the phar file to work on.
Optional arguments:
-i regexβ specifies a regular expression for input files.-x regexβ regular expression for input files to exclude.
β version command
Get information about the PHAR environment and the tool version.
ποΈ COMPRESSION ποΈ
Algorithms, bestie:
0β no compressionnoneβ no compressionautoβ automatically select compression algorithmgzβ GZip compressiongzipβ GZip compressionbz2β BZip2 compressionbzip2β BZip2 compression
π HASH π
Algorithms, keep up:
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 β the whole lore drop fr π
π 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 you find a bug, please report it, don't just suffer in silence π
π 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. 𫢠the way that so many people showed up⦠iconic.
π VERSION INFORMATION π
This manpage describes phar, version 8.5.9.
Β©οΈ 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 thing, bestie π this was the PHAR(1) page from The PHP Group, dated 2024, describing phar version 8.5.9 β go forth and archive responsibly, mwah πβ¨
π¦ where this page comes from
- ubuntu stonking: php8.5-cli 8.5.9-0ubuntu1
- ubuntu stonking: php8.5-cli 8.5.9-0ubuntu2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms