PHP Partial Zip allows you to download files located within remote ZIP files.
Based on planetbeing/partial-zip.
composer require stnvh/php-partialzip ~0.1
Class init method
<?php
$p = new Partial('http://some.site.com/cats.zip', 'cat.png');
Returns a list of all the files in the remote directory
<?php
/*...*/
$list = implode(' ', $p->list()); # = 'cat.png cat2.png cat3.png'
Returns a parsed file object for use when fetching the remote file
<?php
/*...*/
$file = $p->find(); # Returns the cat.png file object (as set on init)
# or
$file = $p->find('cat2.png'); # Search and return other file objects
Returns, or outputs the file fetched from the remote ZIP
<?php
/*...*/
if($file) {
$data = $p->get($file); # Return
# or
$p->get($file, true); # Output (download)
}
<?php
require 'vendor/autoload.php';
use Stnvh\Partial\Zip as Partial;
$p = new Partial('http://some.site.com/cats.zip', 'cat.png');
# Get file object
$file = $p->find();
if($file) {
# Output to browser:
$p->get($file, true);
}