zanysoft / laravel-zip

MIT License
300 stars 95 forks source link

Create temporary archive #52

Closed vanodevium closed 3 months ago

vanodevium commented 1 year ago

How to use:

public function someAction()
{
    $archive = Zip::createTemporary();
    $archive->addFromString('file1.txt', 'file1 content');
    $archive->addFromString('file2.txt', 'file2 content');

    return response()->download($archive->closeTemporary());
}

or simple $archive->close() and then use $archive->getTemporaryFilePath()