Download the PHP package aerni/zipper without Composer
On this page you can find all versions of the php package aerni/zipper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package zipper
Short Description Zip your Statamic assets on the fly
License MIT
Homepage https://github.com/aerni/statamic-zipper
Informations about the package zipper
Zipper
This addon provides a simple way to zip your Statamic assets on the fly.
Installation
Install the addon using Composer:
Publish the config of the package (optional):
The following config will be published to config/zipper.php
:
Basic Usage
To create a zip of your assets, you have to call the zip
tag followed by the variable
containing your assets. The tag returns the URL to the route that handles creating the zip. The zip will be streamed without being saved to disk. You may opt in to save the file to disk to be used on subsequent requests.
Somewhere in your content files:
Somehwere in your views:
Filename
You may optionally pass a filename using the filename
parameter. The filename defaults to the timestamp when the Zip object was created. The example below binds the name of the zip to the title of the page.
Link Expiry
If you want to expire your links after a certain time, you can either set the expiry globally in the config, or use the expiry
parameter on the tag. The expiry is to be set in minutes. Note, that the expiry on the tag will overide the expiry in the config.
Cleanup Old References
Zipper saves an encrypted instance of the Zip class every time it returns a URL. These reference files are stored in storage/zipper/{id}
. Whenever a user downloads a zip, Zipper will retrieve and decrypt the requested Zip instance.
With time, the amound of saved reference files will grow. To get this under control, Zipper provides a scheduled command that will daily delete old reference files. Just make sure that your Scheduler is running.
Cleanup Scopes
There are a couple of cleanup scopes you can define in the config:
Option | Description |
---|---|
expired |
Only delete expired references files. This only affects references of zips that used the expiry option |
all |
Delete all reference files excluding unexpired files. This will delete references of zips that didn't use the expiry option as well as expired zips. It will not delete unexpired zips. |
force |
Delete all reference files including unexpired files. This will completely wipe all references. |
Clean Command
You may also use the clean
command to delete reference files at your will. The scope defaults to expired
.
Advanced Usage
You may also use this addon programmatically as shown below.
All versions of zipper with dependencies
aws/aws-sdk-php Version ^3.224
laravel/framework Version ^9.0 || ^10.0
statamic/cms Version ^4.0
stechstudio/laravel-zipstream Version ^4.8