Skip to content

static helper uncompress() #114

Open
@tacman

Description

@tacman

Is there a helper to uncompress? Currently I'm using the native PHP class ZipArchive, but it seems natural to have an uncompress helper method as well.

    private function unzip(string $filename, string $dir)
    {
        $zip = new ZipArchive();
        if ($zip->open($filename)) {
            $zip->extractTo($dir);
            $zip->close();
        } else {
            $this->io()->error("Unable to unzip $filename to $dir");
        }
    }

    private function zip(string $dir, string $filename)
    {
        // compress a local directory (all files (recursive) in "some/local/directory" are added to archive)
        $zipFile = ZipFile::compress(new \SplFileInfo($dir), $filename);
   }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions