PHAR(1)

πŸ“¦ version 8.3.6, in ubuntu noble

✨ 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:

  • -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:

  • -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.

🧚 compress command 🧚

Compress or uncompress all files or a selected entry. glow up or glow down, 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).

🌈 delete command 🌈

Delete entry from a PHAR archive. bye bestie, we don't know her anymore πŸ’€

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, main character energy πŸ‘‘

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 (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:

  • -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. show me what you're working with.

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. (0 = slay, 1 = nothing was there πŸ™ˆ)

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 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:

  • -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 been taken directly rather then being serialized.

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.

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:

  • -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:

  • -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.

πŸ’– sign command πŸ’–

Set signature hash algorithm. signing off, literally ✍️

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 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.

🌳 tree command 🌳

Get a directory tree for a PHAR archive. family tree but make it 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. vibe check, but for the tool.


πŸ’… 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

πŸŽ€ 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

πŸ‘€ 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 Β© 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