phar
manages PHP Archive files, which bundle PHP applications into single
TLDR
Add files to a PHAR archive
SYNOPSIS
phar command [-f archive] [options] [files...]
DESCRIPTION
phar manages PHP Archive (PHAR) files, which bundle PHP applications into single distributable files. PHAR files can include PHP code, assets, and metadata, and can be executed directly by PHP.
The tool supports creating, modifying, extracting, and signing PHAR archives. Signing ensures archive integrity and authenticity using hash algorithms or OpenSSL keys.
PARAMETERS
-f _archive_
PHAR archive file to operate on-c _algorithm_
Compression algorithm (gzip, bzip2)-h _algorithm_
Hash algorithm for signing-y _keyfile_
Private key file for OpenSSL signing-e _entry_
Specific entry within archive
COMMANDS
add
Add files or directories to archivelist
List contents of archivedelete
Remove files from archivecompress
Compress archive contentsinfo
Display archive informationsign
Sign archive with hash or keyextract
Extract archive contents
CAVEATS
Requires phar.readonly=0 in php.ini for write operations. OpenSSL signing requires the OpenSSL extension. Large archives may consume significant memory during operations.
HISTORY
PHAR (PHP Archive) was introduced in PHP 5.3 as a native way to distribute PHP applications. The phar command-line tool provides archive management capabilities outside of PHP scripts.
