PHP code example of popphp / pop-archive

1. Go to this page and download the library: Download popphp/pop-archive library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

popphp / pop-archive example snippets


$archive = new Pop\Archive\Archive('test.zip');
$archive->extract('/path/to/extract/files');

// It will auto-detect and automatically decompress a compressed TAR file
$archive = new Pop\Archive\Archive('test.tar.gz');
$archive->extract('/path/to/extract/files');

$archive = new Pop\Archive\Archive('test.zip');
$archive->addFiles('/path/to/single/file.txt');
$archive->addFiles([
    '/path/to/multiple/files1.txt',
    '/path/to/multiple/files2.txt',
    '/path/to/multiple/files3.txt',
]);

$archive = new Pop\Archive\Archive('test.tar');
$archive->addFiles('/path/to/folder/of/files');

// Creates the compressed archive file 'test.tar.bz2'
$archive->compress('bz2');