UnifiedArchive v0.1.1 Release Notes

Release Date: 2018-09-21 // about 3 years ago
  • API changes:

    • ๐Ÿ”„ Changed algorithm of files list generation in archiveFiles() and addFiles(): php // 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');
    • 0๏ธโƒฃ Disabled paths expanding in extractFiles() and deleteFiles() by default.

      If you need to expand src/ path to all files within this directory in archive, set second argument $expandFilesList argument to true.

      $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: new type element 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): bool method for checking if archive has a file with specific name.
    • โž• Added getFileResource($file): resource method for getting a file descriptor for reading all file content without full extraction in memory.
    • โž• Added canOpenArchive($archiveFileName): bool and canOpenType($archiveFormat): bool static methods to check if specific archive or format can be opened.
    • โž• Added detectArchiveType($fileName): string|false static 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.


    • โž• Added simple tests.
    • โž• Added phar distribution.