Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PrinceMinky's avatar

Chumper Zipper

I have installed: https://github.com/Chumper/Zipper

And I have run the example code:

        $files = glob('public/js');
        $zip = Zipper::make('test.zip')->add($files);

        return dd($zip);

I die/dumped the Zipper::make and I get

Zipper {#289 ▼
  -currentFolder: ""
  -file: Filesystem {#111}
  -repository: ZipRepository {#288 }
  -filePath: "test.zip"
}

I'm expecting it to make test.zip and but it doesn't. I don't know what's going on?

0 likes
2 replies
aotisg@gmail.com's avatar

I had the same issue so I used the php built-in zip functions.

//The packs of data I want to zip
$pack = array();

 $file_path = storage_path("packs/".$pack->name);

 //Get the name of all the files in that folder
    $files = scandir($file_path);

    //Make the Zip
    $zip = new ZipArchive();
    $filename = "./".$pack->name.".zip";
    
    //If there is an issue... close
    if ($zip->open($filename, ZipArchive::CREATE)!==TRUE) {
        exit("cannot open <$filename>\n");   
    }else{
        foreach($files as $file){
            $zip->addFile($file_path."/".$file,$file);
            //echo "numfiles: " . $zip->numFiles . "\n";
            //echo "status:" . $zip->status . "\n";   
        dump($file_path."/".$file);
        
        }
        exit();   
        $zip->close();
    }

Please or to participate in this conversation.