The Phar class
(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.
类摘要
public __construct(
string $filename
,
int $flags
= FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS,
?string $alias
= null
)
public addFile(
string $filename
,
?string $localName
= null
):
void
final public static canCompress(
int $compression
= 0):
bool
public compress(
int $compression
,
?string $extension
= null
):
?Phar
public convertToData(
?int $format
= null
,
?int $compression
= null
,
?string $extension
= null
):
?PharData
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 delete(
string $localName
):
bool
public extractTo(
string $directory
,
array|string|null $files
= null
,
bool $overwrite
= false
):
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 offsetSet(
string $localName
,
resource|string $value
):
void
final public static running(
bool $returnPhar
= true
):
string
public setDefaultStub(
?string $index
= null
,
?string $webIndex
= null
):
bool
public setStub(
string $stub
,
int $len
= -1):
bool
final public static webPhar(
?string $alias
= null
,
?string $index
= null
,
?string $fileNotFoundScript
= null
,
array $mimeTypes
= [],
?callable $rewrite
= null
):
void
}
目录
cornelius dot howl at gmail dot com ¶11 years ago
Onion utility can help you compile a package into a phar file (executable script file or library file)
https://github.com/c9s/Onion
$ onion.phar compile \
--executable \
--classloader \
--bootstrap scripts/onion.embed \
--lib src \
--lib ../CLIFramework/src \
--lib ../GetOptionKit/src \
--output onion.phar
halfdan ¶15 years ago
Hey, I thought writing a small article about the upcoming functionality and appearance of Phar in php5.3 might be a nice thing. So I did this at http://geekmonkey.org/articles/PHP_Archives - hope to save others some time when working with Phar.