PHP code example of d9magai / phparchive

1. Go to this page and download the library: Download d9magai/phparchive 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/ */

    

d9magai / phparchive example snippets


use D9magai\Zip\TmpArchive;

// create TmpArchive
$tmpArchive = TmpArchive(new \ZipArchive(), __DIR__ . '/tmp');
// add file to tmpArchive
$tmpArchive->addFile($filePath);
// saving tmpArchive
$tmpArchive->save();
// get tmpArchive path
$zipPath = $tmpArchive->getPath();