All notable changes to php-archive
will be documented in this file.
- 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::class
methodreadFromString(string $contents, ?string $password = null, ?string $extension = null)
to read an archive from a string - When you read RAR or 7z archives with
p7zip
binary, 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: theoutputPath
inside archive andpathToFile
on disk -
is removedaddFiles()
-
addDirectory()
takes two parameters now:relativeTo
path inside archive and thepath
of directory on the disk- If the
path
is/path/to/dir
andrelativeTo
is./dir
, the directory will be added to archive asdir/
- If the
-
is removedaddDirectories()
- Add
skipAllowed
param toArchive::class
- For
ArchiveZipCreate::class
add 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
get
prefix. For example,getPath()
instead ofpath()
,getFilename()
instead offilename()
, etc. It concerns all simple getters ofBasicArchive
,ArchiveItem
,ArchiveStat
,PdfMeta
,ArchiveCreate
classes.
Why? All these classes have some methods like setters or actions. To be consistent and clear, all simple getters have now
get
prefix.
BaseArchive
can nowfindFiles
with auto sort
BaseArchive
,findFiles
can now sort natural files
- Fix Windows temporary path issue
- add
spatie/temporary-directory
for temporary directory management
ArchivePdf
disable Exception
for content
- rename
PdfMetadata
toPdfMeta
- replace
ArchiveMetadata::class
withArchiveStat::class
:$archive->stat()
fromstat
native function - all PDF metadata are now stored in
PdfMetadata::class
:$archive->pdf()
ArchiveMetadata
addtoArray
methods
BaseArchive
fix forArchiveItem
nullable safe
- Archive
content
allowArchiveItem
nullable for$file
param
ArchiveMetadata
keywords bug array fix
- Improve documentation
Archive::create
is nowArchive::make
: can create or edit archives
- improve documentation
- remove
findAndContent
findAll
is nowfilter
- Fix:
findAll
method with index
sortFiles
reindex allfiles
Rewriting of package
- Handle ZIP, TAR with native PHP
- Handle RAR with
rar
PHP extension or withp7zip
binary ifrar
extension is not available - Handle 7Z with
p7ip
binary
Changes in API
- static
make
:read
contentFile
:content
- Add
text
to get only text (useful for PDF) - Add
extract
andextractAll
to extract archives - Add static
create
to create new archive (only ZIP supported)
Change API
extractFile
tocontentFile
forArchive::class
extractPage
tocontentPage
forArchivePdf::class