(no description)
File Size: | 200 lines (8 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
ZipHelper:: (10 methods):
createZip()
getZipFilePath()
addFileToArchive()
addUncompressedFileToArchive()
addFolderToArchive()
closeArchiveAndCopyToStream()
addFileToArchiveWithCompressionMethod()
shouldSkipFile()
getNormalizedRealPath()
copyZipToStream()
createZip(string $tmpFolderPath) X-Ref |
Returns a new ZipArchive instance pointing at the given path. param: string $tmpFolderPath Path of the temp folder where the zip file will be created |
getZipFilePath(ZipArchive $zip) X-Ref |
param: ZipArchive $zip An opened zip archive object return: string Path where the zip file of the given folder will be created |
addFileToArchive(ZipArchive $zip, string $rootFolderPath, string $localFilePath, string $existingFileMode = self::EXISTING_FILES_OVERWRITE) X-Ref |
Adds the given file, located under the given root folder to the archive. The file will be compressed. Example of use: addFileToArchive($zip, '/tmp/xlsx/foo', 'bar/baz.xml'); => will add the file located at '/tmp/xlsx/foo/bar/baz.xml' in the archive, but only as 'bar/baz.xml' param: ZipArchive $zip An opened zip archive object param: string $rootFolderPath path of the root folder that will be ignored in the archive tree param: string $localFilePath Path of the file to be added, under the root folder param: string $existingFileMode Controls what to do when trying to add an existing file |
addUncompressedFileToArchive(ZipArchive $zip, string $rootFolderPath, string $localFilePath, string $existingFileMode = self::EXISTING_FILES_OVERWRITE) X-Ref |
Adds the given file, located under the given root folder to the archive. The file will NOT be compressed. Example of use: addUncompressedFileToArchive($zip, '/tmp/xlsx/foo', 'bar/baz.xml'); => will add the file located at '/tmp/xlsx/foo/bar/baz.xml' in the archive, but only as 'bar/baz.xml' param: ZipArchive $zip An opened zip archive object param: string $rootFolderPath path of the root folder that will be ignored in the archive tree param: string $localFilePath Path of the file to be added, under the root folder param: string $existingFileMode Controls what to do when trying to add an existing file |
addFolderToArchive(ZipArchive $zip, string $folderPath, string $existingFileMode = self::EXISTING_FILES_OVERWRITE) X-Ref |
param: ZipArchive $zip An opened zip archive object param: string $folderPath Path to the folder to be zipped param: string $existingFileMode Controls what to do when trying to add an existing file |
closeArchiveAndCopyToStream(ZipArchive $zip, $streamPointer) X-Ref |
Closes the archive and copies it into the given stream. param: ZipArchive $zip An opened zip archive object param: resource $streamPointer Pointer to the stream to copy the zip |
addFileToArchiveWithCompressionMethod(ZipArchive $zip, string $rootFolderPath, string $localFilePath, string $existingFileMode, int $compressionMethod) X-Ref |
Adds the given file, located under the given root folder to the archive. The file will NOT be compressed. Example of use: addUncompressedFileToArchive($zip, '/tmp/xlsx/foo', 'bar/baz.xml'); => will add the file located at '/tmp/xlsx/foo/bar/baz.xml' in the archive, but only as 'bar/baz.xml' param: ZipArchive $zip An opened zip archive object param: string $rootFolderPath path of the root folder that will be ignored in the archive tree param: string $localFilePath Path of the file to be added, under the root folder param: string $existingFileMode Controls what to do when trying to add an existing file param: int $compressionMethod The compression method |
shouldSkipFile(ZipArchive $zip, string $itemLocalPath, string $existingFileMode) X-Ref |
return: bool Whether the file should be added to the archive or skipped |
getNormalizedRealPath(string $path) X-Ref |
Returns canonicalized absolute pathname, containing only forward slashes. param: string $path Path to normalize return: string Normalized and canonicalized path |
copyZipToStream(string $zipFilePath, $pointer) X-Ref |
Streams the contents of the zip file into the given stream. param: string $zipFilePath Path of the zip file param: resource $pointer Pointer to the stream to copy the zip |