Repository navigation
0.1.1: API changes, improvements
Important API changes:
-
Changed algorithm of files list generation in
archiveFiles()andaddFiles():// 1. one file $archive->archiveFiles('/var/www/site/abc.log', 'archive.zip'); // => stored as 'abc.log' // 2. directory $archive->archiveFiles('/var/www/site/runtime/logs', 'archive.zip'); // => directory content stored in archive root // 3. list $archive->archiveFiles([ '/var/www/site/abc.log' => 'abc.log', // stored as 'abc.log' '/var/www/site/abc.log', // stored as '/var/www/site/abc.log' '/var/www/site/runtime/logs' => 'logs', // directory content stored in 'logs' dir '/var/www/site/runtime/logs', // stored as '/var/www/site/runtime/logs' ], 'archive.zip');
-
Disabled paths expanding in
extractFiles()anddeleteFiles()by default.If you need to expand
src/path to all files within this directory in archive, set second argument$expandFilesListargument totrue.$archive->extractFiles(__DIR__, 'src/', true); $archive->deleteFiles('tests/', true);
-
Added new element in
archiveFiles()result in emulation mode. Now it returns an archive with 4 elements: addedtypeelement with archive type.
Fixes:
- Fixed LZW-stream (.tar.Z) wrapper (before it didn't work).
- Fixed ISO archives reading (before archive size could be calculated wrong).
- Fixed CAB archives extraction in
getFileContent($file)(before it didn't work). - Improved extraction in
getFileContent($file)for RAR archives by using streams (before it did extract file in temporarily folder, read it and then delete it).
Improvements:
- Added
isFileExists($file): boolmethod for checking if archive has a file with specific name. - Added
getFileResource($file): resourcemethod for getting a file descriptor for reading all file content without full extraction in memory. - Added
canOpenArchive($archiveFileName): boolandcanOpenType($archiveFormat): boolstatic methods to check if specific archive or format can be opened. - Added
detectArchiveType($fileName): string|falsestatic method to detect (by filename or content) archive type. - Added
addFile($file, $inArchiveName = null)/addDirectory($directory, $inArchivePath = null)to add one file or one directory,archiveFile($file, $archiveName)/archiveDirectory($directory, $archiveName)to archive one file or directory.
Miscellaneous:
- Added simple tests.
- Added
phardistribution.