Download the PHP package madnest/madzipper without Composer

On this page you can find all versions of the php package madnest/madzipper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package madzipper

Madzipper

This is a simple Wrapper around the ZipArchive methods with some handy functions.

Build Status

Installation

  1. madnest/madzipper can be installed by running:

  2. Optionally when using with Laravel, go to app/config/app.php

You can now access Madzipper with the Madzipper alias.

Versions

Package Laravel PHP
v1.5 11.* ^8.2
v1.4 10.* ^8.1
v1.3 9.* ^8.0
v1.2 8.* ^8.0

Simple Laravel example by using Madzipper facade

Another example

Note: Please be aware that you need to call ->close() at the end to write the zip file to disk.

You can easily chain most functions, except getFileContent, getStatus, close and extractTo which must come at the end of the chain.

The main reason I wrote this little package is the extractTo method since it allows you to be very flexible when extracting zips. So you can for example implement an update method which will just override the changed files.

Functions

make($pathToFile)

Create or Open a zip archive; if the file does not exists it will create a new one. It will return the Zipper instance so you can chain easily.

add($files/folder)

You can add an array of Files, or a Folder and all the files in that folder will then be added, so from the first example we could instead do something like $files = 'public/files/';.

addString($filename, $content)

add a single file to the zip by specifying a name and the content as strings.

remove($file/s)

removes a single file or an array of files from the zip.

folder($folder)

Specify a folder to 'add files to' or 'remove files from' from the zip, example

listFiles($regexFilter = null)

Lists all files within archive (if no filter pattern is provided). Use $regexFilter parameter to filter files. See Pattern Syntax for regular expression syntax

NB: listFiles ignores folder set with folder function

Example: Return all files/folders ending/not ending with '.log' pattern (case insensitive). This will return matches in sub folders and their sub folders also

home()

Resets the folder pointer.

zip($fileName)

Uses the ZipRepository for file handling.

getFileContent($filePath)

get the content of a file in the zip. This will return the content or false.

getStatus()

get the opening status of the zip as integer.

close()

closes the zip and writes all changes.

extractTo($path)

Extracts the content of the zip archive to the specified location, for example

This will go into the folder test in the zip file and extract the content of that folder only to the folder foo, this is equal to using the Madzipper::WHITELIST.

This command is really nice to get just a part of the zip file, you can also pass a 2nd & 3rd param to specify a single or an array of files that will be

NB: Php ZipArchive uses internally '/' as directory separator for files/folders in zip. So Windows users should not set whitelist/blacklist patterns with '\' as it will not match anything

white listed

Madzipper::WHITELIST

Which will extract the test.zip into the public folder but only files/folders starting with vendor prefix inside the zip will be extracted.

or black listed

Madzipper::BLACKLIST Which will extract the test.zip into the public folder except files/folders starting with vendor prefix inside the zip will not be extracted.

Madzipper::EXACT_MATCH

Which will extract the test.zip into the public folder but only files/folders exact matching names. So this will:

NB: extracting files/folder from zip without setting Madzipper::EXACT_MATCH When zip has similar structure as below and only test.bat is given as whitelist/blacklist argument then extractTo would extract all those files and folders as they all start with given string

extractMatchingRegex($path, $regex)

Extracts the content of the zip archive matching regular expression to the specified location. See Pattern Syntax for regular expression syntax.

Example: extract all files ending with .php from src folder and its sub folders.

Example: extract all files except those ending with test.php from src folder and its sub folders.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Development

Maybe it is a good idea to add other compression functions like rar, phar or bzip2 etc... Everything is setup for that, if you want just fork and develop further.

If you need other functions or got errors, please leave an issue on github.

Credits

Big thank you goes to @Chumper for creating the original package Chumper/Zipper


All versions of madzipper with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
ext-zip Version *
illuminate/support Version ^8.0
illuminate/filesystem Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package madnest/madzipper contains the following files

Loading the files please wait ....