1. Reference: In Laravel 6, based on ZipStream PHP, stream the zip file to the S3 bucket. Reference: Generate a stream resource based on Fopen in PHP 7.4, operate the disk, and adjust it to a memory-based implementation. The compression and decompression is successful based on 360, and the decompression based on WinRAR fails. as shown in Figure 1

2. Use 7Z to decompress on Linux. Although it can be decompressed, there is still an error message. as shown in Figure 2

ERRORS:
Unexpected end of archive
--
Path = assets_new.zip
Type = zip
ERRORS:
Unexpected end of archive
Physical Size = 781844
Archives with Errors: 1
Open Errors: 1
3. Reference:https://maennchen.dev/ZipStream-PHP/guide/FlySystem.html. Before uploading the stream, you need to execute: $zip->finish();
Before adjustment:
$name = $this->themeInstallationTask->themeInstallation->theme_id . '/assets.zip';
$stream = fopen('php://memory', 'w+');
$options = new Archive();
$options->setOutputStream($stream);
$zip = new ZipStream($name, $options);
$zip->addFile(str_replace('\\', '/', str_replace(self::$destination . '/', '', $file->getPathname())), $file->getContents());
Storage::disk(config('theme_asset.filesystem.disk'))->putStream(
$name,
$stream,
config('theme_asset.filesystem.options')
);
$zip->finish();
fclose($stream);
After adjustment:
$name = $this->themeInstallationTask->themeInstallation->theme_id . '/assets.zip';
$stream = fopen('php://memory', 'w+');
$options = new Archive();
$options->setOutputStream($stream);
$zip = new ZipStream($name, $options);
$zip->addFile(str_replace('\\', '/', str_replace(self::$destination . '/', '', $file->getPathname())), $file->getContents());
$zip->finish();
Storage::disk(config('theme_asset.filesystem.disk'))->putStream(
$name,
$stream,
config('theme_asset.filesystem.options')
);
fclose($stream);
4. The compression and decompression is successful based on 360, and the decompression is successful based on WinRAR.
PHP / Laravel / Yii2 Legacy Project Maintenance & Long-Term Technical Support
If your PHP / Laravel / Yii2 project is already in production but needs bug fixing, API troubleshooting, performance optimization, developer handover support, or long-term maintenance, feel free to contact me for remote technical support.
Ideal For:
✅ PHP legacy systems without active maintenance
✅ Laravel / Yii2 project bug fixes
✅ Admin panel feature iterations
✅ RESTful API troubleshooting
✅ MySQL / Redis / Nginx performance issues
✅ Long-term remote part-time maintenance
We can start with a small task:
✅ Production error troubleshooting
✅ API issue analysis
✅ Slow query and performance bottleneck diagnosis
✅ Initial code structure review
✅ Deployment environment and log inspection
If you would like to discuss your project, please contact me and mention: PHP Maintenance Consultation.
Contact Me:
Telegram: @shuijingwan
WeChat: 13980074657
Email: shuijingwanwq@gmail.com

Leave a Reply