- How do I install Zippy in a Laravel project?
- Run `composer require alchemy/zippy` in your project root. No additional Laravel-specific setup is required, though you may need to register it as a singleton in `AppServiceProvider` for DI integration. Ensure PHP’s `mbstring` extension is enabled (default in Laravel).
- Does Zippy work with Laravel’s Storage facade (e.g., S3, local disks)?
- Yes. Zippy supports streams, so you can pass Laravel Storage paths (e.g., `Storage::disk('s3')->path('file.zip')`) to methods like `open()` or `create()`. For remote files, use teleporters like `StreamTeleporter` to wrap streams from APIs or databases.
- What Laravel versions and PHP versions does Zippy support?
- Zippy requires PHP 7.1+, but Laravel 8.0+ is recommended due to PHP 8.x compatibility. Test thoroughly with your Laravel version, as the last release (2021) may lack PHP 8.2+ optimizations. Check `extension_loaded('zip')` or `extension_loaded('bz2')` for tar support.
- Can I use Zippy for large archives (e.g., >2GB) without memory issues?
- Zippy doesn’t natively support chunked processing, so large archives may hit PHP’s `memory_limit`. For critical paths, use PHP’s native `ZipArchive` (fallback adapter) or process archives in chunks via Laravel Queues. Monitor memory usage in production.
- How do I handle tar archives if the system lacks GNU/BSD tar binaries?
- Zippy defaults to CLI tools (e.g., `tar`), but you can force PHP-native adapters like `ZipArchive` for ZIPs. For tar, ensure Docker/CI environments include `tar`/`bzip2` in `PATH`, or switch to PHP’s `PharData` for limited tar support. Test with `Zippy::load(['tar' => 'php'])` to force PHP adapters.
- Is Zippy safe for user-uploaded archives (e.g., virus scanning, symlinks)?
- Zippy lacks built-in validation, so user-uploaded archives pose risks (e.g., malicious payloads, symlinks). Validate files pre-archive (e.g., `Filesystem::exists()`) and scan for viruses post-extraction. For sensitive data, encrypt archives with OpenSSL before/after processing.
- How can I integrate Zippy with Laravel Queues for async archive processing?
- Wrap Zippy in a Laravel Job (e.g., `ArchiveJob`). Dispatch it with `ArchiveJob::dispatch($archiveData)`. Use PHP-native adapters (e.g., `ZipArchive`) for CLI-dependent operations to avoid blocking. Handle failures with retries or dead-letter queues.
- Are there alternatives to Zippy for Laravel archive handling?
- Yes. For ZIPs, consider `league/flysystem-archive-plugin` (integrates with Flysystem) or `spatie/laravel-temporary-filesystem` for ephemeral archives. For tar, `phpseclib` or `patp/phar` offer limited alternatives, but none match Zippy’s CLI+extension hybrid approach.
- How do I customize file paths when creating archives in Zippy?
- Pass an associative array to `create()` where keys define paths inside the archive. Example: `['folder' => '/path/to/directory']` creates `folder/` at the root. For remote files (e.g., URLs), use teleporters like `StreamTeleporter` to stream content directly into the archive.
- What’s the maintenance status of Zippy, and should I fork it?
- Zippy’s last release was in 2021, with no active maintenance. Risks include PHP 8.2+ incompatibilities or unpatched vulnerabilities. Mitigate by wrapping Zippy in a service layer, testing with Laravel 10+, and monitoring for forks (e.g., `league/flysystem-archive-plugin` as a backup).