Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dimsav/unix-zipper
A simple zip compression library for Unix operating systems. UnixZipper is ideal for creating backups of your projects in unix servers.
https://github.com/dimsav/unix-zipper
Last synced: 29 days ago
JSON representation
A simple zip compression library for Unix operating systems. UnixZipper is ideal for creating backups of your projects in unix servers.
- Host: GitHub
- URL: https://github.com/dimsav/unix-zipper
- Owner: dimsav
- License: mit
- Created: 2013-09-11T21:59:18.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-01-18T22:57:45.000Z (almost 11 years ago)
- Last Synced: 2024-09-19T23:39:36.909Z (about 2 months ago)
- Language: PHP
- Size: 1.01 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.md
Awesome Lists containing this project
README
# UnixZipper
[![Latest Stable Version](https://poser.pugx.org/dimsav/unix-zipper/v/stable.png)](https://packagist.org/packages/dimsav/unix-zipper) [![Build Status](https://travis-ci.org/laravel/framework.png)](https://travis-ci.org/dimsav/unix-zipper)
A simple zip compression library for Unix operating systems.
UnixZipper is ideal for creating backups of your projects in unix servers.## Features
1. Easy to use
2. Password protection
2. Tested for stability## How does it work
Here is a simple example. Feel free to check the tests to see the class in action.
```php
// Instantiate the class
$zipper = new UnixZipper();// Add absolute paths of directories or files for compression
$zipper->add('/absolute/path/to/some/directory');
$zipper->add('/absolute/path/to/file.txt');// Exclude directories and files
$zipper->exclude('/absolute/path/to/some/directory');
$zipper->exclude('/absolute/path/to/some/file.txt');// Add a password if you wish
$zipper->setPassword('my_password');// The path of the file that will be generated
// If the given path doesn't exist, it will be created automatically.
$zipper->setDestination('/file/after/compression/test.zip');// Do the magic
$zipper->compress();
```Since version 1.2, you can set a base path, and provide the files to be compressed relatively.
```php
$zipper = new UnixZipper();// Set base path
$zipper->setAbsolutePathAsBase('/absolute/projects');// Add relative paths of directories or files for compression
$zipper->add('project-1'); // /absolute/projects/project-1
$zipper->add('logs/file.txt'); // /absolute/projects/logs/file.txt$zipper->setDestination('/file/after/compression/test.zip');
// Compress
$zipper->compress();
```## Why unix
The reason I chose to make this package unix-only is because I wanted to rely
on the system's zip function, that offers stability and flexibility. It also
offers the possibility to exclude directories recursively, a feature I couldn't
find in other php classes.## Installation
Install using composer:
1. Add `"dimsav/unix-zipper": "1.*"` to your composer.json file
2. Run `composer update`## Dependencies
The only requirements are:
* executing the code on a unix system
* composer for installing/autoloading