unread
Hi,
I've just implemented these features:
-
new getContents() method allows directly retrieving file contents.
Here is a full-circle example:
<?php
$phar = new Phar('blah.phar');
$phar['a.txt'] = 'hi';
echo $phar['a.txt']->getContents();
?> -
addFile/addEmptyDir/addFromString. API is identical to ext/zip
<?php
$phar = new Phar('blah.phar');
$phar->addEmptyDir('hello');
var_dump($phar['hello']->isDir());
$phar->addFile('/path/to/file.txt');
var_dump($phar['/path/to/file.txt']->getContents());
$phar->addFile('/path/to/file.txt', 'file.txt');
var_dump($phar['file.txt']->getContents());
$phar->addFromString('localname.txt', 'hi');
var_dump($phar['localname.txt']);
?>
Still left to do:
- fix up conversion/compression and decide how best to do this
- buildFromDirectory (Steph)
Not going to do:
- $phar['access']['directory']['this']['way']
Greg