The Phar class
(PHP 5 >= 5.3.0, PHP 7, PECL phar >= 1.0.0)
Introducere
The Phar class provides a high-level interface to accessing and creating
phar archives.
Sinopsisul clasei
public addFile
(
string $file
[,
string $localname
] ) :
void
public addFromString
(
string $localname
,
string $contents
) :
void
final public static canCompress
([
int $type
= 0
] ) :
bool
public compress
(
int $compression
[,
string $extension
] ) :
Phar
public __construct
(
string $fname
[,
int $flags
[,
string $alias
]] )
public convertToData
([
int $format
= 9021976
[,
int $compression
= 9021976
[,
string $extension
]]] ) :
PharData
public convertToExecutable
([
int $format
= 9021976
[,
int $compression
= 9021976
[,
string $extension
]]] ) :
Phar
public copy
(
string $oldfile
,
string $newfile
) :
bool
final public static createDefaultStub
([
string $indexfile
[,
string $webindexfile
]] ) :
string
public delete
(
string $entry
) :
bool
public extractTo
(
string $pathto
[,
string|array|null $files
= null
[,
bool $overwrite
= false
]] ) :
bool
final public static isValidPharFilename
(
string $filename
[,
bool $executable
= true
] ) :
bool
final public static loadPhar
(
string $filename
[,
string $alias
] ) :
bool
final public static mapPhar
([
string $alias
[,
int $dataoffset
= 0
]] ) :
bool
final public static mount
(
string $pharpath
,
string $externalpath
) :
void
final public static mungServer
(
array $munglist
) :
void
public offsetSet
(
string $offset
,
string $value
) :
void
final public static running
([
bool $retphar
= true
] ) :
string
public setAlias
(
string $alias
) :
bool
public setDefaultStub
([
string $index
[,
string $webindex
]] ) :
bool
public setStub
(
string $stub
[,
int $len
= -1
] ) :
bool
final public static webPhar
([
string $alias
[,
string $index
= "index.php"
[,
string $f404
[,
array $mimetypes
[,
callable $rewrites
]]]]] ) :
void
}
Cuprins
cornelius dot howl at gmail dot com ¶13 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 ¶16 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.