PHP Classes

File: test-stream.php

Recommend this page to a friend!
  Classes of David Tamas   ZipFly PHP ZipArchive zip64 Creator   test-stream.php   Download  
File: test-stream.php
Role: Example script
Content type: text/plain
Description: - Added debug mode - Added options to enable/disable the ZIP64 extension - Added option to enable/disable the streamed zip feature - New class hierarchy for the new static variables based centralization - Lot of memory and performance optimization - Code cleanup
Class: ZipFly PHP ZipArchive zip64 Creator
Compress files and create archives in Zip format
Author: By
Last change: - Documented the source code
- Configurable duplicate entry filter
- New methods for add entries to the archive:
- addFile - Add entry from file
- addFromString - Add entry from string input
- addFromStream - Add entry from stream resource
- Compress small files in one step instead of streamed processing
- Ability to directly stream out the generated ZIP file to the browser or any stream resource without saving it to the local storage.
- Separated the debug functionality
- Improved Exception system
- Code cleanup
- Speed and memory optimizations
- Minimum required PHP version: 5.6.3
Date: 5 years ago
Size: 917 bytes
 

Contents

Class file image Download
<?php


function gAutoLoader($class) {
   
$class = str_replace('\\', DIRECTORY_SEPARATOR, $class);

    if (
is_readable($class . '.php')) {
        include_once
$class . '.php';
        return
true;
    }

    return
false;
}

spl_autoload_register('gAutoLoader');


define('GTEST_DIR', __DIR__.'/');

if (isset(
$argv[1])) {
   
$nr = $argv[1];
} else {
   
$nr = '';
}



$zipFile = new \zipFly\zipFly64();
$zipFile->setDebugMode(false);
$zipFile->setZipFeature(true, true);

//$zipFile->create(GTEST_DIR.'onfly'.$nr.'.zip');
$zipFile->create(fopen('php://output', 'wb'));

$zipFile->addFile(GTEST_DIR."zipFly/parts/headers.php", "parts/headers.php", \zipFly\zipFly64::METHOD_DEFLATE);
$zipFile->addFile(GTEST_DIR."zipFly/zipFly64.php", "zipFly64.php", \zipFly\zipFly64::METHOD_BZIP2);
$zipFile->addFile(GTEST_DIR."zipFly/parts/entry.php", "parts/entry.php", \zipFly\zipFly64::METHOD_DEFLATE);

$zipFile->close();