public function buildZip($file, $basePath)
    {
        yield 'Generating zip file ' . $file;

        $zip = new \ZipArchive();
        $res = $zip->open($file, \ZipArchive::CREATE);

        if ($res === true) {
            $this->buildZipArchive($basePath, $zip, $basePath, 0);
            $zip->close();

            yield 'Generation completed file size ' . (round(filesize($file) / 1024, 2)) . 'kb';
        } else {
            throw new \RuntimeException('Could not create zip file ' . $file);
        }
    }
public function buildZip($file, $basePath)
    {
        yield 'Generating zip file ' . $file;

        $zip = new \ZipArchive();
        $res = $zip->open($file, \ZipArchive::CREATE);

        if ($res === true) {
            $this->buildZipArchive($basePath, $zip, $basePath, 0);
            $zip->close();

            yield 'Generation completed file size ' . (round(filesize($file) / 1024, 2)) . 'kb';
        } else {
            throw new \RuntimeException('Could not create zip file ' . $file);
        }
    }
public function buildZip ( $ file , $ basePath ) { yield 'Generating zip file ' . $ file ; $ zip = new \ ZipArchive ( ) ; $ res = $ zip -> open ( $ file , \ ZipArchive :: CREATE ) ; if ( $ res === true ) { $ this -> buildZipArchive ( $ basePath , $ zip , $ basePath , 0 ) ; $ zip -> close ( ) ; yield 'Generation completed file size ' . ( round ( filesize ( $ file ) / 1024 , 2 ) ) . 'kb' ; } else { throw new \ RuntimeException ( 'Could not create zip file ' . $ file ) ; } }
Creates a zip archive for the provided file using all files located at
the base path

@param string $file
@param string $basePath
@return \Generator
Creates a zip archive for the provided file using all files located at the base path