Downloads
Documentation
Get Involved
Help
Getting Started
Introduction
A simple tutorial
Language Reference
Basic syntax
Types
Variables
Constants
Expressions
Operators
Control Structures
Functions
Classes and Objects
Namespaces
Enumerations
Errors
Exceptions
Fibers
Generators
Attributes
References Explained
Predefined Variables
Predefined Exceptions
Predefined Interfaces and Classes
Predefined Attributes
Context options and parameters
Supported Protocols and Wrappers
Security
Introduction
General considerations
Installed as CGI binary
Installed as an Apache module
Session Security
Filesystem Security
Database Security
Error Reporting
User Submitted Data
Hiding PHP
Keeping Current
Features
HTTP authentication with PHP
Cookies
Sessions
Dealing with XForms
Handling file uploads
Using remote files
Connection handling
Persistent Database Connections
Command line usage
Garbage Collection
DTrace Dynamic Tracing
Function Reference
Affecting PHP's Behaviour
Audio Formats Manipulation
Authentication Services
Command Line Specific Extensions
Compression and Archive Extensions
Cryptography Extensions
Database Extensions
Date and Time Related Extensions
File System Related Extensions
Human Language and Character Encoding Support
Image Processing and Generation
Mail Related Extensions
Mathematical Extensions
Non-Text MIME Output
Process Control Extensions
Other Basic Extensions
Other Services
Search Engine Extensions
Server Specific Extensions
Session Extensions
Text Processing
Variable and Type Related Extensions
Web Services
Windows Only Extensions
XML Manipulation
GUI Extensions
Keyboard Shortcuts
?
This help
j
Next menu item
k
Previous menu item
g p
Previous man page
g n
Next man page
G
Scroll to bottom
g g
Scroll to top
g h
Goto homepage
g s
Goto search
(current page)
/
Focus search box
Introduction »
« lzf_optimized_for
PHP Manual
Function Reference
Compression and Archive Extensions
Change language:
English
Chinese (Simplified)
Other
Phar
Introduction
Installing/Configuring
Requirements
Installation
Runtime Configuration
Resource Types
Predefined Constants
Using Phar Archives
Using Phar Archives: Introduction
Using Phar Archives: the phar stream wrapper
Using Phar Archives: the Phar and PharData class
Creating Phar Archives
Creating Phar Archives: Introduction
What makes a phar a phar and not a tar or a zip?
Ingredients of all Phar archives, independent of file format
Phar file stub
Head-to-head comparison of Phar, Tar and Zip
Tar-based phars
Zip-based phars
Phar File Format
Global Phar bitmapped flags
Phar manifest file entry definition
Phar Signature format
Phar
— The Phar class
Phar::addEmptyDir
— Add an empty directory to the phar archive
Phar::addFile
— Add a file from the filesystem to the phar archive
Phar::addFromString
— Add a file from a string to the phar archive
Phar::apiVersion
— Returns the api version
Phar::buildFromDirectory
— Construct a phar archive from the files within a directory
Phar::buildFromIterator
— Construct a phar archive from an iterator
Phar::canCompress
— Returns whether phar extension supports compression using either zlib or bzip2
Phar::canWrite
— Returns whether phar extension supports writing and creating phars
Phar::compress
— Compresses the entire Phar archive using Gzip or Bzip2 compression
Phar::compressFiles
— Compresses all files in the current Phar archive
Phar::__construct
— Construct a Phar archive object
Phar::convertToData
— Convert a phar archive to a non-executable tar or zip file
Phar::convertToExecutable
— Convert a phar archive to another executable phar archive file format
Phar::copy
— Copy a file internal to the phar archive to another new file within the phar
Phar::count
— Returns the number of entries (files) in the Phar archive
Phar::createDefaultStub
— Create a phar-file format specific stub
Phar::decompress
— Decompresses the entire Phar archive
Phar::decompressFiles
— Decompresses all files in the current Phar archive
Phar::delMetadata
— Deletes the global metadata of the phar
Phar::delete
— Delete a file within a phar archive
Phar::__destruct
— Destructs a Phar archive object
Phar::extractTo
— Extract the contents of a phar archive to a directory
Phar::getAlias
— Get the alias for Phar
Phar::getMetadata
— Returns phar archive meta-data
Phar::getModified
— Return whether phar was modified
Phar::getPath
— Get the real path to the Phar archive on disk
Phar::getSignature
— Return MD5/SHA1/SHA256/SHA512/OpenSSL signature of a Phar archive
Phar::getStub
— Return the PHP loader or bootstrap stub of a Phar archive
Phar::getSupportedCompression
— Return array of supported compression algorithms
Phar::getSupportedSignatures
— Return array of supported signature types
Phar::getVersion
— Return version info of Phar archive
Phar::hasMetadata
— Returns whether phar has global meta-data
Phar::interceptFileFuncs
— Instructs phar to intercept fopen, file_get_contents, opendir, and all of the stat-related functions
Phar::isBuffering
— Used to determine whether Phar write operations are being buffered, or are flushing directly to disk
Phar::isCompressed
— Returns Phar::GZ or PHAR::BZ2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)
Phar::isFileFormat
— Returns true if the phar archive is based on the tar/phar/zip file format depending on the parameter
Phar::isValidPharFilename
— Returns whether the given filename is a valid phar filename
Phar::isWritable
— Returns true if the phar archive can be modified
Phar::loadPhar
— Loads any phar archive with an alias
Phar::mapPhar
— Reads the currently executed file (a phar) and registers its manifest
Phar::mount
— Mount an external path or file to a virtual location within the phar archive
Phar::mungServer
— Defines a list of up to 4 $_SERVER variables that should be modified for execution
Phar::offsetExists
— Determines whether a file exists in the phar
Phar::offsetGet
— Gets a PharFileInfo object for a specific file
Phar::offsetSet
— Set the contents of an internal file to those of an external file
Phar::offsetUnset
— Remove a file from a phar
Phar::running
— Returns the full path on disk or full phar URL to the currently executing Phar archive
Phar::setAlias
— Set the alias for the Phar archive
Phar::setDefaultStub
— Used to set the PHP loader or bootstrap stub of a Phar archive to the default loader
Phar::setMetadata
— Sets phar archive meta-data
Phar::setSignatureAlgorithm
— Set the signature algorithm for a phar and apply it
Phar::setStub
— Used to set the PHP loader or bootstrap stub of a Phar archive
Phar::startBuffering
— Start buffering Phar write operations, do not modify the Phar object on disk
Phar::stopBuffering
— Stop buffering write requests to the Phar archive, and save changes to disk
Phar::unlinkArchive
— Completely remove a phar archive from disk and from memory
Phar::webPhar
— Routes a request from a web browser to an internal file within the phar archive
PharData
— The PharData class
PharData::addEmptyDir
— Add an empty directory to the tar/zip archive
PharData::addFile
— Add a file from the filesystem to the tar/zip archive
PharData::addFromString
— Add a file from a string to the tar/zip archive
PharData::buildFromDirectory
— Construct a tar/zip archive from the files within a directory
PharData::buildFromIterator
— Construct a tar or zip archive from an iterator
PharData::compress
— Compresses the entire tar/zip archive using Gzip or Bzip2 compression
PharData::compressFiles
— Compresses all files in the current tar/zip archive
PharData::__construct
— Construct a non-executable tar or zip archive object
PharData::convertToData
— Convert a phar archive to a non-executable tar or zip file
PharData::convertToExecutable
— Convert a non-executable tar/zip archive to an executable phar archive
PharData::copy
— Copy a file internal to the phar archive to another new file within the phar
PharData::decompress
— Decompresses the entire Phar archive
PharData::decompressFiles
— Decompresses all files in the current zip archive
PharData::delMetadata
— Deletes the global metadata of a zip archive
PharData::delete
— Delete a file within a tar/zip archive
PharData::__destruct
— Destructs a non-executable tar or zip archive object
PharData::extractTo
— Extract the contents of a tar/zip archive to a directory
PharData::isWritable
— Returns true if the tar/zip archive can be modified
PharData::offsetSet
— Set the contents of a file within the tar/zip to those of an external file or string
PharData::offsetUnset
— Remove a file from a tar/zip archive
PharData::setAlias
— Dummy function (Phar::setAlias is not valid for PharData)
PharData::setDefaultStub
— Dummy function (Phar::setDefaultStub is not valid for PharData)
PharData::setMetadata
— Sets phar archive meta-data
PharData::setSignatureAlgorithm
— Set the signature algorithm for a phar and apply it
PharData::setStub
— Dummy function (Phar::setStub is not valid for PharData)
PharFileInfo
— The PharFileInfo class
PharFileInfo::chmod
— Sets file-specific permission bits
PharFileInfo::compress
— Compresses the current Phar entry with either zlib or bzip2 compression
PharFileInfo::__construct
— Construct a Phar entry object
PharFileInfo::decompress
— Decompresses the current Phar entry within the phar
PharFileInfo::delMetadata
— Deletes the metadata of the entry
PharFileInfo::__destruct
— Destructs a Phar entry object
PharFileInfo::getCRC32
— Returns CRC32 code or throws an exception if CRC has not been verified
PharFileInfo::getCompressedSize
— Returns the actual size of the file (with compression) inside the Phar archive
PharFileInfo::getContent
— Get the complete file contents of the entry
PharFileInfo::getMetadata
— Returns file-specific meta-data saved with a file
PharFileInfo::getPharFlags
— Returns the Phar file entry flags
PharFileInfo::hasMetadata
— Returns the metadata of the entry
PharFileInfo::isCRCChecked
— Returns whether file entry has had its CRC verified
PharFileInfo::isCompressed
— Returns whether the entry is compressed
PharFileInfo::setMetadata
— Sets file-specific meta-data saved with a file
PharException
— The PharException class
Improve This Page
Learn How To Improve This Page
•
Submit a Pull Request
•
Report a Bug
+
add a note
User Contributed Notes
There are no user contributed notes for this page.