Releases: stechstudio/laravel-zipstream
Conflict handling
Conflict handling
If two or more files are added to the zip with the same zip path, you can use ZIPSTREAM_CONFLICT_STRATEGY
to configure how the conflict is handled:
ZIPSTREAM_CONFLICT_STRATEGY=skip
: Keep the initial file, skip adding the conflicting file (default)ZIPSTREAM_CONFLICT_STRATEGY=replace
: Keep the latest file, overwrite previous files at the same pathZIPSTREAM_CONFLICT_STRATEGY=rename
: Append a number to the conflicting file name, e.g.file.txt
becomesfile_1.txt
Note: filenames are compared case-insensitive. FILE.txt
and file.TXT
are considered conflicting. If you are working only on a case-sensitive filesystem you can set ZIPSTREAM_CASE_INSENSITIVE_CONFLICTS=false
. Don't do this if you have Windows users opening your zips!
Version 5.0
Version 5 is a major refactor of this package based on ZipStream 3.1. 🎉
Breaking changes
- The config file has been rearranged a bit. If you published the config file you'll need to do that again.
STS\ZipStream\ZipStream
is nowSTS\ZipStream\Builder
. You may need to update some typehints in your code.STS\ZipStream\ZipStreamFacade
is nowSTS\ZipStream\Facades\Zip
. The globalZip
alias is still registered.- ENV
ZIPSTREAM_FILE_METHOD
is nowZIPSTREAM_COMPRESSION_METHOD
- ENV
ZIPSTREAM_FILE_SANITIZE
is nowZIPSTREAM_ASCII_FILENAMES
Other changes
- All zips are
Zip64
now as they are widely supported. - We flush zip output right away. This reduces buffering and memory usage, and gets zip output to the user started as quickly as possible.
- Header
X-Accel-Buffering: no
is added for nginx. See here.
New features
$zip->has($path)
to check if a file already was added$zip->addFromDisk($diskName, $source, $zipPath)
to add files using a Laravel storage disk$zip->saveToDisk($diskName, $folder)
to save output to a Laravel storage disk$zip->then(function() { // do something after zip is finished sending });
to handle any cleanup or other post-zipping tasks$zip->setComment(...)
for adding comments to the main zip file$file->setComment(...)
for individual file comments (you have to useFile::make
yourself to have access to the file instance and use this)
5.0-beta.1
Added:
$zip->has($path)
to check if a file already was added$zip->addFromDisk($diskName, $source, $zipPath)
to add files using a Laravel storage disk$zip->saveToDisk($diskName, $folder)
to save output to a Laravel storage disk$zip->then(function() { // do something after zip is finished sending });
- Uses
$flushOutput
to minimize zip buffering and RAM usage and get zip output faster to user
5.0-beta
This is a major refactor based on ZipStream 3.1.
A few backwards compatible breaks:
STS\ZipStream\ZipStream
is nowSTS\ZipStream\Builder
. You may need to update some typehints in your code.STS\ZipStream\ZipStreamFacade
is nowSTS\ZipStream\Facades\Zip
. The globalZip
alias is still registered.- The config file has been rearranged a bit. If you published the config file you'll need to do that again.
A few ENVs have been renamed:
ZIPSTREAM_FILE_METHOD
=>ZIPSTREAM_COMPRESSION_METHOD
ZIPSTREAM_FILE_SANITIZE
=>ZIPSTREAM_ASCII_FILENAMES
Laravel 11 support
4.14 L11
Laravel 10 support
4.12 this is pretty large as well
Laravel 9 support
4.6 update badge
Config file changes
This version changes the way S3 clients are created, just a bit. It is only a breaking change if you were previously relying on an empty set of AWS credentials to prompt credentials = false
in the S3 client. For everyone else this major version is backwards compatible.
For S3 client creation now:
-
If you have credentials specified in your .env file they are used, as always.
-
If you have no credentials specified, no credentials are handed to the S3Client. This means the AWS SDK will attempt to find credentials using the default chain.
-
If you set
AWS_ANONYMOUS=true
in your .env file, this library will setcredentials = false
when creating the client, which explicitly creates an anonymous client.
php8 support
3.1 add php8 to travis
2.4: Merge pull request #18 from it-can/master
update maennchen/zipstream-php to v2