Skip to content

Commit

Permalink
Revert class name change
Browse files Browse the repository at this point in the history
  • Loading branch information
aerni committed Aug 13, 2024
1 parent 28e070f commit d6e23cb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Somewhere in your views:

### Filename

You may optionally pass a filename using the `filename` parameter. The filename defaults to the current timestamp when the Zipper object is created. The example below binds the zip name to the page title.
You may optionally pass a filename using the `filename` parameter. The filename defaults to the current timestamp when the Zip object is created. The example below binds the zip name to the page title.

```antlers
{{ zip:images :filename="title" }}
Expand All @@ -52,7 +52,7 @@ If you want to expire your links after a certain time, you can either set the ex

## Cleanup Old References

Zipper saves an encrypted instance of the Zipper class every time it returns a URL. This class is later retrieved and decrypted when a user downloads a zip. These reference files are stored in `storage/zipper/{id}`.
Zipper saves an encrypted instance of the Zip class every time it returns a URL. This class is later retrieved and decrypted when a user downloads a zip. These reference files are stored in `storage/zipper/{id}`.

With time, the number of saved reference files will grow. To control this, Zipper provides a scheduled command that will delete old reference files daily. Just make sure that your Scheduler is running.

Expand Down Expand Up @@ -81,7 +81,7 @@ php please zipper:clean --scope=force
You may also use this addon programmatically, as shown below.

```php
use Aerni\Zipper\Zipper;
use Aerni\Zipper\Zip;

// Prepare an array of Statamic assets, paths, or URLs.
$files = [
Expand All @@ -91,7 +91,7 @@ $files = [
];

// Make a zip with the files above.
$zip = Zipper::make($files);
$zip = Zip::make($files);

// Set an optional filename. This defaults to the timestamp when the object was created.
$zip->filename('obi-wan-kenobi');
Expand Down
6 changes: 3 additions & 3 deletions src/Zipper.php → src/Zip.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
use League\Flysystem\Local\LocalFilesystemAdapter;
use Statamic\Contracts\Assets\Asset;
use STS\ZipStream\Builder;
use STS\ZipStream\Facades\Zip;
use STS\ZipStream\Facades\Zip as ZipStreamZip;
use STS\ZipStream\Models\File;
use Symfony\Component\HttpFoundation\StreamedResponse;

class Zipper
class Zip
{
protected Collection $files;

Expand Down Expand Up @@ -137,7 +137,7 @@ public function get(): Builder|StreamedResponse
*/
protected function create(): Builder
{
$zip = Zip::create("{$this->filename}.zip");
$zip = ZipStreamZip::create("{$this->filename}.zip");

$this->files->each(fn ($file) => $this->addFileToZip($file, $zip));

Expand Down
3 changes: 2 additions & 1 deletion src/ZipperTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Aerni\Zipper;

use Aerni\Zipper\Zip;
use Illuminate\Support\Arr;
use Statamic\Contracts\Assets\Asset;
use Statamic\Facades\Compare;
Expand All @@ -27,7 +28,7 @@ public function wildcard(): ?string
return null;
}

return Zipper::make($files)
return Zip::make($files)
->filename($this->params->get('filename'))
->expiry($this->params->get('expiry') ?? (int) config('zipper.expiry'))
->url();
Expand Down

0 comments on commit d6e23cb

Please sign in to comment.