Temp Zip for Download

<?php

$file = tempnam("tmp","zip");
$zip = new ZipArchive();
$zip->open($file,ZipArchive::OVERWRITE);

//Throw an extra file in dynamically
$dynamic_content = 'This is the README file that comes with your downloaded zip. Waka Waka';
$zip->addFromString('readme.txt', $dynamic_content);

//Include files in archive
$zip->addFile('testfile.txt', 'testfile.txt');
$zip->addFile('testfile2.txt', 'testfile2.txt');

$zip->close();

header('Content-Type: application/zip');
header('Content-Length: ' . filesize($file));
header('Content-Disposition: attachment; filename="myzippedfiles.zip"');

readfile($file);
unlink($file);

?>