array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'it', ), 'this' => array ( 0 => 'phar.using.stream.php', 1 => 'Using Phar Archives: the phar stream wrapper', ), 'up' => array ( 0 => 'phar.using.php', 1 => 'Using Phar Archives', ), 'prev' => array ( 0 => 'phar.using.intro.php', 1 => 'Using Phar Archives: Introduction', ), 'next' => array ( 0 => 'phar.using.object.php', 1 => 'Using Phar Archives: the Phar and PharData class', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/phar/using.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
The Phar stream wrapper fully supports fopen() for read and write (not append), unlink(), stat(), fstat(), fseek(), rename() and directory stream operations opendir() and rmdir() and mkdir().
Individual file compression and per-file metadata can also be manipulated in a Phar archive using stream contexts:
<?php
$context = stream_context_create(array('phar' =>
array('compress' => Phar::GZ)),
array('metadata' => array('user' => 'cellog')));
file_put_contents('phar://my.phar/somefile.php', 0, $context);
?>
The phar
stream wrapper does not operate on remote files,
and cannot operate on remote files, and so is allowed even when the
allow_url_fopen and
allow_url_include INI options
are disabled.
Although it is possible to create phar archives from scratch just using stream operations, it is best to use the functionality built into the Phar class. The stream wrapper is best used for read-only operations.