Welcome Guest, Not a member yet? Register   Sign In
ZipArchive: class not found
#5

(This post was last modified: 11-26-2019, 11:21 AM by Poetawd.)

CI4 is awesome because you can use almost any library with it !

For working with ZIP Files I recommend this one: https://github.com/Ne-Lexa/php-zip

It is AWESOME and has some great features !

It is very simple to make it work with CI4. Easier with composer !

Please tell me if you need help installing it.

Here is a example how to use the library:

PHP Code:
        $projectName 'Project';

        
$projectDirectory ROOTPATH '/../folder';

        
$zipComments 'Some Comments';

        
$zipFile = new \PhpZip\ZipFile();

        try {            

            
$zipFile
                
->addDirRecursive($projectDirectory)
                ->
setArchiveComment($zipComments)
                ->
setPassword('12345'// set password for all entries
                
->outputAsAttachment('filename.zip'); // output to the browser without saving to a file

        
} catch (\PhpZip\Exception\ZipException $e) {
            
// handle exception
        


This code will ZIP a entire folder, including sub-directories, set comments for the ZIP file, set a password and output it to browser without saving the file in server !

Awesome right ?
Reply


Messages In This Thread
ZipArchive: class not found - by Olivier85 - 11-26-2019, 08:15 AM
RE: ZipArchive: class not found - by ciadmin - 11-26-2019, 09:38 AM
RE: ZipArchive: class not found - by Olivier85 - 11-26-2019, 09:46 AM
RE: ZipArchive: class not found - by MGatner - 11-26-2019, 10:18 AM
RE: ZipArchive: class not found - by Poetawd - 11-26-2019, 11:17 AM
RE: ZipArchive: class not found - by pvt - 05-01-2022, 10:52 AM
RE: ZipArchive: class not found - by dgvirtual - 05-05-2022, 10:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB