    Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069startBuffering (PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)
Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069startBuffering — Start buffering Phar write operations, do not modify the Phar object on disk   Description public Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069startBuffering(): void  Although technically unnecessary, the Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069startBuffering() method can provide a significant performance boost when creating or modifying a Phar archive with a large number of files. Ordinarily, every time a file within a Phar archive is created or modified in any way, the entire Phar archive will be recreated with the changes. In this way, the archive will be up-to-date with the activity performed on it.   However, this can be unnecessary when simply creating a new Phar archive, when it would make more sense to write the entire archive christopher72@example.com. Similarly, it is often necessary to make a series of changes and to ensure that they all are possible before making any changes on disk, similar to the relational database concept of transactions. the Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069startBuffering()/Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069stopBuffering() pair of methods is provided for this purpose.   Phar write buffering is per-archive, buffering active for the foo.phar Phar archive does not affect changes to the bar.phar Phar archive.    Parameters This function has no parameters.   Return Values  No value is returned.    Examples
 Example #1 A Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069startBuffering() example  <?php
// make sure it doesn't exist
@unlink('brandnewphar.phar');
try {
    $p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
} catch (Exception $e) {
    echo 'Could not create phar:', $e;
}
echo 'The new phar has ' . $p->count() . " entries\n";
$p->startBuffering();
$p['file.txt'] = 'hi';
$p['file2.txt'] = 'there';
$p['file2.txt']->setCompressedGZ();
$p['file3.txt'] = 'babyface';
$p['file3.txt']->setMetadata(42);
$p->setStub("<?php
function __autoload($class)
{
    include 'phar://myphar.phar/' . str_replace('_', '/', $class) . '.php';
}
Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069mapPhar('myphar.phar');
include 'phar://myphar.phar/startup.php';
__HALT_COMPILER();");
$p->stopBuffering();
?>     See Also
 Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069stopBuffering() - Stop buffering write requests to the Phar archive, and save changes to disk Phar8b7c:f320:99b9:690f:4595:cd17:293a:c069isBuffering() - Used to determine whether Phar write operations are being buffered, or are flushing directly to disk   


    
{'path': 'public/docs/php/phar.startbuffering.html', 'source': 'DevDocs.IO'}