PHP code example of devuri / zipit

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

    

devuri / zipit example snippets




return [
    'baseDir' => __DIR__, // The base directory where files are located
    'files' => [          // List of files and directories to 'directory1/exclude-this.txt',
        'file-to-exclude.txt',
    ],
    'outputDir' => __DIR__ . '/build', // Optional: Custom output directory path
    'outputFile' => 'project-archive.zip', // Optional: Custom output file name
];



return [
    'baseDir' => __DIR__,
    'files' => [
        'file1.txt',
        'file2.txt',
        'directory1',
    ],
    'exclude' => [
        'directory1/exclude-this.txt',
    ],
    'outputFile' => __DIR__ . '/project-archive.zip', // Optional: Custom output file name
];
bash
bin/zipit /path/to/.zipit-conf.php

/my-project
  |-- file1.txt
  |-- file2.txt
  |-- /directory1
      |-- file3.txt
      |-- exclude-this.txt
  |-- .zipit-conf.php