Hi,

I've just implemented these features:

1) 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();
?>

2) 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:

1) fix up conversion/compression and decide how best to do this
2) buildFromDirectory (Steph)

Not going to do:

1) $phar['access']['directory']['this']['way']

Greg

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to