PHP code example of commando1251 / archive

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

    

commando1251 / archive example snippets




mmando1251\Archive\ArchiveCreator;

try {
    $archive = new ArchiveCreator('test' . time() . '.zip');
    $archive->add('/var/www/archive_test/pics/folder1/1.jpg');
    $archive->add('/var/www/archive_test/pics/folder1/2.jpg', 'test_folder');
    $archive->build();
} catch (Exception $exception) {
    echo $exception->getMessage();
}



return [
  ...
  'providers' => [
  ....
    Commando1251\Archive\Laravel\ArchiveServiceProvider::class
  ]
];



return [
  ...
  'aliases' => [
  ....
    'Archive' => Commando1251\Archive\Laravel\Facades\Archive::class
  ]
];