codeless/ziparchiveex

Extension of the PHP integrated ZipArchive class for recursively adding directories

v1.0.1 2012-09-24 11:11 UTC

This package is not auto-updated.

Last update: 2023-09-15 14:02:19 UTC


README

ZipArchiveEx is an extension of the PHP integrated ZipArchive class.

Detailed description

When PHP is compiled with zip support, the programmer can make use of the ZipArchive class. Although the implementation seems to be very complete, the compression of subfolders and files in these subfolders has to be written by the script-programmer himself. ZipArchiveEx implements the addDir method, which adds exactly this missing functionality.

Usage

# ZipArchive as usual:
$zip = new ZipArchiveEx();
$zip->open('my.zip', ZIPARCHIVE::OVERWRITE);

# Add whole directory including contents:
$zip->addDir('mydir');

# Only add the contents of the directory, but
# not the directory-entry of "mydir" itself:
$zip->addDirContents('mydir');

# Close archive (as usual):
$zip->close();

Installation

ZipArchiveEx is provided as Composer package and can be installed via Packagist.

Resources

History

  • Version 1.0.1 released on 2012-09-24
    • Added the addDirContents() method
  • Version 1.0.0 released on 2012-09-18

License

ZipArchiveEx is available under the MIT license:

Copyright (c) 2012 more@codeless.at

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.