Thursday, 1 March 2007
Know About PHP_Archive and Phar |
| |
|
| |
Vinu Thomas in a new post over his blog, talks about PHP_Archive and Phar. He says there’s an easy way to package your PHP application without having to copy tons of files across servers. This new PHP extension allows you to create and use PHAR (PHP Archive) files.
He gives the following code to make use of it:
<<? include 'phar:///full/path/to/my.phar/file.php'; ? >
He informs you that Phar provides both a stream wrapper (phar://) and a Phar class, which can be used to access the contents of a Phar archive. For the uninitiated Phar Archive is a virtual file system that is customized for use with PHP, sort of like a Java .jar archive.
The .phar files can be read using the Phar stream, or with the Phar class. If the SPL extension is available, a Phar object can be used as an array to iterate over a Phar’s contents or to read files directly from the Phar, he explains.
He further adds Phar archives can be created using the streams API or with the Phar class, if the phar.readonly ini variable is set to false.
|
| |
|
Read the Post
Related Reading: Know About the New PECL Extension Phar
|
| |
|
|
| |
|
|
| |
|