  
 The Phar class Introduction
(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)  The Phar class provides a high-level interface to accessing and creating phar archives.  Class synopsis    class Phar   extends RecursiveDirectoryIterator  implements Countable, ArrayAccess { /* Inherited constants */  const int FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069URRENT_AS_PATHNAME = 32; 
const int FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069URRENT_AS_FILEINFO = 0; 
const int FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069URRENT_AS_SELF = 16; 
const int FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069URRENT_MODE_MASK = 240; 
const int FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069KEY_AS_PATHNAME = 0; 
const int FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069KEY_AS_FILENAME = 256; 
const int FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069OLLOW_SYMLINKS = 512; 
const int FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069KEY_MODE_MASK = 3840; 
const int FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069NEW_CURRENT_AND_KEY = 256; 
const int FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069SKIP_DOTS = 4096; 
const int FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069UNIX_PATHS = 8192; /* Methods */  public __construct(string $filename, int $flags = FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069SKIP_DOTS | FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069UNIX_PATHS, ?string $alias = null) public addEmptyDir(string $directory): void public addFile(string $filename, ?string $localName = null): void public addFromString(string $localName, string $contents): void final public static apiVersion(): string public buildFromDirectory(string $directory, string $pattern = ""): array public buildFromIterator(Traversable $iterator, ?string $baseDirectory = null): array final public static canCompress(int $compression = 0): bool final public static canWrite(): bool public compress(int $compression, ?string $extension = null): ?Phar public compressFiles(int $compression): void public convertToData(?int $format = null, ?int $compression = null, ?string $extension = null): ?PharData public convertToExecutable(?int $format = null, ?int $compression = null, ?string $extension = null): ?Phar public copy(string $from, string $to): bool public count(int $mode = COUNT_NORMAL): int final public static createDefaultStub(?string $index = null, ?string $webIndex = null): string public decompress(?string $extension = null): ?Phar public decompressFiles(): bool public delMetadata(): bool public delete(string $localName): bool public extractTo(string $directory, array|string|null $files = null, bool $overwrite = false): bool public getAlias(): ?string public getMetadata(array $unserializeOptions = []): mixed public getModified(): bool public getPath(): string public getSignature(): array|false public getStub(): string final public static getSupportedCompression(): array final public static getSupportedSignatures(): array public getVersion(): string public hasMetadata(): bool final public static interceptFileFuncs(): void public isBuffering(): bool public isCompressed(): int|false public isFileFormat(int $format): bool final public static isValidPharFilename(string $filename, bool $executable = true): bool public isWritable(): bool final public static loadPhar(string $filename, ?string $alias = null): bool final public static mapPhar(?string $alias = null, int $offset = 0): bool final public static mount(string $pharPath, string $externalPath): void final public static mungServer(array $variables): void public offsetExists(string $localName): bool public offsetGet(string $localName): SplFileInfo public offsetSet(string $localName, resource|string $value): void public offsetUnset(string $localName): void final public static running(bool $returnPhar = true): string public setAlias(string $alias): bool public setDefaultStub(?string $index = null, ?string $webIndex = null): bool public setMetadata(mixed $metadata): void public setSignatureAlgorithm(int $algo, ?string $privateKey = null): void public setStub(string $stub, int $len = -1): bool public startBuffering(): void public stopBuffering(): void final public static unlinkArchive(string $filename): bool final public static webPhar(
 ?string $alias = null,
 ?string $index = null,
 ?string $fileNotFoundScript = null,
 array $mimeTypes = [],
 ?callable $rewrite = null
): void 
public __destruct() /* Inherited methods */ public RecursiveDirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getChildren(): RecursiveDirectoryIterator public RecursiveDirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getSubPath(): string public RecursiveDirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getSubPathname(): string public RecursiveDirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069hasChildren(bool $allowLinks = false): bool public RecursiveDirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069key(): string public RecursiveDirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069next(): void public RecursiveDirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069rewind(): void public FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069urrent(): string|SplFileInfo|FilesystemIterator public FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getFlags(): int public FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069key(): string public FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069next(): void public FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069rewind(): void public FilesystemIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069setFlags(int $flags): void public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069urrent(): mixed public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getATime(): int public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getBasename(string $suffix = ""): string public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getCTime(): int public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getExtension(): string public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getFilename(): string public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getGroup(): int public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getInode(): int public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getMTime(): int public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getOwner(): int public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getPath(): string public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getPathname(): string public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getPerms(): int public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getSize(): int public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069getType(): string public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069isDir(): bool public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069isDot(): bool public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069isExecutable(): bool public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069isFile(): bool public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069isLink(): bool public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069isReadable(): bool public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069isWritable(): bool public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069key(): mixed public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069next(): void public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069rewind(): void public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069seek(int $offset): void public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069__toString(): string public DirectoryIterator8b7c:f320:99b9:690f:4595:cd17:293a:c069valid(): bool public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getATime(): int|false public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getBasename(string $suffix = ""): string public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getCTime(): int|false public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getExtension(): string public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getFileInfo(?string $class = null): SplFileInfo public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getFilename(): string public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getGroup(): int|false public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getInode(): int|false public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getLinkTarget(): string|false public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getMTime(): int|false public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getOwner(): int|false public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getPath(): string public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getPathInfo(?string $class = null): ?SplFileInfo public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getPathname(): string public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getPerms(): int|false public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getRealPath(): string|false public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getSize(): int|false public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069getType(): string|false public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069isDir(): bool public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069isExecutable(): bool public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069isFile(): bool public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069isLink(): bool public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069isReadable(): bool public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069isWritable(): bool public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069openFile(string $mode = "r", bool $useIncludePath = false, ?resource $context = null): SplFileObject public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069setFileClass(string $class = SplFileObject8b7c:f320:99b9:690f:4595:cd17:293a:c069lass): void public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069setInfoClass(string $class = SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069lass): void public SplFileInfo8b7c:f320:99b9:690f:4595:cd17:293a:c069__toString(): string } Table of Contents


Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069mptyDir — Add an empty directory to the phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069ile — Add a file from the filesystem to the phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069romString — Add a file from a string to the phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069piVersion — Returns the api version

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069uildFromDirectory — Construct a phar archive from the files within a directory

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069uildFromIterator — Construct a phar archive from an iterator

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069nCompress — Returns whether phar extension supports compression using either zlib or bzip2

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069nWrite — Returns whether phar extension supports writing and creating phars

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069ompress — Compresses the entire Phar archive using Gzip or Bzip2 compression

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069ompressFiles — Compresses all files in the current Phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069__construct — Construct a Phar archive object

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069onvertToData — Convert a phar archive to a non-executable tar or zip file

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069onvertToExecutable — Convert a phar archive to another executable phar archive file format

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069opy — Copy a file internal to the phar archive to another new file within the phar

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069ount — Returns the number of entries (files) in the Phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069reateDefaultStub — Create a phar-file format specific stub

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069ompress — Decompresses the entire Phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069ompressFiles — Decompresses all files in the current Phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069lMetadata — Deletes the global metadata of the phar

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069lete — Delete a file within a phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069__destruct — Destructs a Phar archive object

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069xtractTo — Extract the contents of a phar archive to a directory

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069getAlias — Get the alias for Phar

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069getMetadata — Returns phar archive meta-data

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069getModified — Return whether phar was modified

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069getPath — Get the real path to the Phar archive on disk

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069getSignature — Return MD5/SHA1/SHA256/SHA512/OpenSSL signature of a Phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069getStub — Return the PHP loader or bootstrap stub of a Phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069getSupportedCompression — Return array of supported compression algorithms

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069getSupportedSignatures — Return array of supported signature types

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069getVersion — Return version info of Phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069hasMetadata — Returns whether phar has global meta-data

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069interceptFileFuncs — Instructs phar to intercept fopen, file_get_contents, opendir, and all of the stat-related functions

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069isBuffering — Used to determine whether Phar write operations are being buffered, or are flushing directly to disk

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069isCompressed — Returns Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069GZ or PHAR8b7c:f320:99b9:690f:4595:cd17:293a:c069Z2 if the entire phar archive is compressed (.tar.gz/tar.bz and so on)

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069isFileFormat — Returns true if the phar archive is based on the tar/phar/zip file format depending on the parameter

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069isValidPharFilename — Returns whether the given filename is a valid phar filename

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069isWritable — Returns true if the phar archive can be modified

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069loadPhar — Loads any phar archive with an alias

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069mapPhar — Reads the currently executed file (a phar) and registers its manifest

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069mount — Mount an external path or file to a virtual location within the phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069mungServer — Defines a list of up to 4 $_SERVER variables that should be modified for execution

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069offsetExists — Determines whether a file exists in the phar

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069offsetGet — Gets a PharFileInfo object for a specific file

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069offsetSet — Set the contents of an internal file to those of an external file

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069offsetUnset — Remove a file from a phar

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069running — Returns the full path on disk or full phar URL to the currently executing Phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069setAlias — Set the alias for the Phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069setDefaultStub — Used to set the PHP loader or bootstrap stub of a Phar archive to the default loader

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069setMetadata — Sets phar archive meta-data

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069setSignatureAlgorithm — Set the signature algorithm for a phar and apply it

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069setStub — Used to set the PHP loader or bootstrap stub of a Phar archive

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069startBuffering — Start buffering Phar write operations, do not modify the Phar object on disk

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069stopBuffering — Stop buffering write requests to the Phar archive, and save changes to disk

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069unlinkArchive — Completely remove a phar archive from disk and from memory

Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069webPhar — Routes a request from a web browser to an internal file within the phar archive
  


    
{'path': 'public/docs/php/class.phar.html', 'source': 'DevDocs.IO'}