Warning . It is impossible to do in memory. ZipArchivecannot work with "memory mapped files".
You can get the file data inside a zip file into a variable (memory) using file_get_contents Docs , as it supports Docszip:// stream wrapper :
$zipFile = './data/zip.kmz';
$fileInZip = 'test.txt';
$path = sprintf('zip://%s#%s', $zipFile, $fileInZip);
$fileData = file_get_contents($path);
zip:// ZipArchive. :
$zip = 'http://www.curriculummagic.com/AdvancedBalloons.kmz';
$file = 'doc.kml';
$ext = pathinfo($zip, PATHINFO_EXTENSION);
$temp = tempnam(sys_get_temp_dir(), $ext);
copy($zip, $temp);
$data = file_get_contents("zip://$temp#$file");
unlink($temp);