You would open the file, creating it most likely with temp name. Something like this:
$name = tempnam('/tmp','zip');
$z->open($name, ZIPARCHIVE::CREATE)
After you finish adding all your files, you would close it.
$z->close();
Now when you are ready to send the data you would do this:
readfile($name);
After you are done, you want to clean up the temp file with:
unlink($name);