All notable changes to php-archive will be documented in this file.
For ArchiveTemporaryDirectory temporary directory name is now based on a UUID format: archive_{prefix}_{uniq} where prefix is a random 4-character string and uniq is a unique identifier generated using uniqid().
PR #54 by @onigoetz: Various bugfixes due to humans being humans
- Missing escaping of CLI arguments
- Errors swallowed hiding the original error
- Sometimes a .cbz is a RAR file, sometimes a .cbr is a ZIP file
Thanks to @onigoetz for the PR!
Note: macOS test with RAR extension removed.
- Add password option for ZIP, RAR and 7z files, using
read(string $path, ?string $password = null)andreadFromString(string $contents, ?string $password = null, ?string $extension = null)methods. - Add new
Archive::classmethodreadFromString(string $contents, ?string $password = null, ?string $extension = null)to read an archive from a string - When you read RAR or 7z archives with
p7zipbinary, you can set manually the path to the binary usingoverrideBinaryPath(string $path)method. getFiles()method is now deprecated. UsegetFileItems()instead.- New method
getFileItem(string $path)to get a single file item.
Drop symfony/process from dependencies.
- All
getContent()methods are nowgetContents() - Old
getContent()methods are deprecated and will be removed in v3.0.0
- If PDF has no metadata, parser works with empty metadata
Rework Archive::make()
-
addFile()takes two parameters now: theoutputPathinside archive andpathToFileon disk -
is removedaddFiles() -
addDirectory()takes two parameters now:relativeTopath inside archive and thepathof directory on the disk- If the
pathis/path/to/dirandrelativeTois./dir, the directory will be added to archive asdir/
- If the
-
is removedaddDirectories()
- Add
skipAllowedparam toArchive::class
- For
ArchiveZipCreate::classadd extensions check:zip,epub,cbz, add an option to skip the check. - For
Archive::class, convertpath(),extension()andtype()togetPath(),getExtension()andgetType(). - Add docblocks to
Archive::class.
- All simple getters have now
getprefix. For example,getPath()instead ofpath(),getFilename()instead offilename(), etc. It concerns all simple getters ofBasicArchive,ArchiveItem,ArchiveStat,PdfMeta,ArchiveCreateclasses.
Why? All these classes have some methods like setters or actions. To be consistent and clear, all simple getters have now
getprefix.
BaseArchivecan nowfindFileswith auto sort
BaseArchive,findFilescan now sort natural files
- Fix Windows temporary path issue
- add
spatie/temporary-directoryfor temporary directory management
ArchivePdf disable Exception for content
- rename
PdfMetadatatoPdfMeta
- replace
ArchiveMetadata::classwithArchiveStat::class:$archive->stat()fromstatnative function - all PDF metadata are now stored in
PdfMetadata::class:$archive->pdf()
ArchiveMetadataaddtoArraymethods
BaseArchivefix forArchiveItemnullable safe
- Archive
contentallowArchiveItemnullable for$fileparam
ArchiveMetadatakeywords bug array fix
- Improve documentation
Archive::createis nowArchive::make: can create or edit archives
- improve documentation
- remove
findAndContent findAllis nowfilter
- Fix:
findAllmethod with index
sortFilesreindex allfiles
Rewriting of package
- Handle ZIP, TAR with native PHP
- Handle RAR with
rarPHP extension or withp7zipbinary ifrarextension is not available - Handle 7Z with
p7ipbinary
Changes in API
- static
make:read contentFile:content- Add
textto get only text (useful for PDF) - Add
extractandextractAllto extract archives - Add static
createto create new archive (only ZIP supported)
Change API
extractFiletocontentFileforArchive::classextractPagetocontentPageforArchivePdf::class