<?php
$zip = new ZipArchive();
$zipName = "..".DIRECTORY_SEPARATOR."test_excel.zip";
$sfolder = '..'.DIRECTORY_SEPARATOR.'Excel';

$zip->open($zipName,ZipArchive::CREATE);

modifiyFileName($sfolder,$zip);

$zip->close();

function modifiyFileName($path,&$zip){
    if(!is_dir($path)){
        return false;
    }
    if($dh = opendir($path)){
        while (($file = readdir($dh)) !== false){
            if(in_array($file,['.','..',null])) continue;
            if(is_dir($path.DIRECTORY_SEPARATOR.$file)){
                $zip->addEmptyDir($path.DIRECTORY_SEPARATOR.$file);
                modifiyFileName($path.DIRECTORY_SEPARATOR.$file,$zip);
            }else{
				$zip->addFile($path.DIRECTORY_SEPARATOR.$file,$path.DIRECTORY_SEPARATOR.$file);
            }
        }
    }
}