markocupic / zip-bundle
Provides a simple ZIP extension for zipping directories recursively.
1.2.0
2026-10-09 13:30 UTC
Requires
- php: ^8.2
- ext-zip: *
- contao/core-bundle: ^5.3 || ^6.0
- symfony/config: ^6.4 || ^7.0 || ^8.0
- symfony/finder: ^6.4 || ^7.0 || ^8.0
- symfony/http-foundation: ^6.4 || ^7.0 || ^8.0
- symfony/mime: ^6.4 || ^7.0 || ^8.0
- symfony/string: ^6.4 || ^7.0 || ^8.0
Requires (Dev)
- contao/manager-plugin: ^2.0
- contao/test-case: ^5.3 || ^6.0
Suggests
None
Provides
None
Conflicts
- contao/manager-plugin: <2.0 || >=3.0
Replaces
None
README
Zip extension
This bundle provides a simple Zip class.
Usage
// Add dir recursive with unlimited depth, add dot files and folders too and store it to a given zip-file $zip = (new \Markocupic\ZipBundle\Zip\Zip()) ->ignoreDotFiles(false) ->stripSourcePath('path/to/source/dir') ->addDirRecursive('path/to/source/dir') ->run('path/to/destination/dir/myZip.zip'); // Add dir recursive depth: 1, collect only files and ignore empty folders $zip = (new \Markocupic\ZipBundle\Zip\Zip()) ->stripSourcePath('path/to/source/dir') ->addDirRecursive('path/to/source/dir', 1, true) ->run('path/to/destination/dir/myZip.zip'); // Add a file $zip = (new \Markocupic\ZipBundle\Zip\Zip()) ->stripSourcePath('path/to/source/dir') ->addFile('path/to/source/dir/myFile.txt') ->run('path/to/destination/dir/myZip.zip'); // Add files from a directory $zip = (new \Markocupic\ZipBundle\Zip\Zip()) ->stripSourcePath('path/to/source/dir') ->addDir('path/to/source/dir') ->run('path/to/destination/dir/myZip.zip'); // Add files from a directory $zip = (new \Markocupic\ZipBundle\Zip\Zip()) ->stripSourcePath('path') ->addDir('path/to/source/dir') ->addDir('path/toAnotherDir/source/dir') ->run('path/to/destination/dir/myZip.zip');
