Skip to content
xp-frameworkPublic

About

ZIP File support for the XP Framework

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

18,525 Commits

Folders and files

Repository files navigation

ZIP File support

Build status on GitHub XP Framework Module BSD Licence Requires PHP 7.0+ Supports PHP 8.0+ Latest Stable Version

Usage (creating a zip file)

use io\archive\zip\{ZipFile, ZipDirEntry, ZipFileEntry};
use io\File;

$z= ZipFile::create(new File('dist.zip'));

// Add a directory
$dir= $z->add(new ZipDirEntry('META-INF'));

// Add a file
$file= $z->add(new ZipFileEntry($dir, 'version.txt'));
$file->out()->write($contents);

// Close
$z->close();

Usage (reading a zip file)

use io\archive\zip\ZipFile;
use io\streams\Streams;
use io\File;

$z= ZipFile::open(new File('dist.zip'));
foreach ($z->entries() as $entry) {
  if ($entry->isDirectory()) {
    // Create dir
  } else {
    // Extract
    Streams::readAll($entry->in());
  }
}

About

ZIP File support for the XP Framework

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages