Yii 1.1: ezip

EZip - for zip archives
16 followers

This extension is for working with zip. Based on comments to http://www.php.net/manual/en/function.zip-open.php

Documentation

Requirements

  • Yii 1.0 or above

Installation

  • Extract the release file under protected/extensions/zip

Usage

Introduce EZip to Yii. Add definition to CWebApplication config file (main.php)

'components'=>array(
    ...
    'zip'=>array(
        'class'=>'application.extensions.zip.EZip',
    ),
    ...
),

Now you can access EZip methods as follows:

$zip = Yii::app()->zip;
 
$zip->makeZip('./','./toto.zip'); // make an ZIP archive
var_export($zip->infosZip('./toto.zip'), false); // get infos of this ZIP archive (without files content)
var_export($zip->infosZip('./toto.zip')); // get infos of this ZIP archive (with files content)
$zip->extractZip('./toto.zip', './1/'); //

Change Log

May 31, 2010

  • Initial release.

Total 4 comments

#7685 report it
thanhansoft at 2012/04/09 08:44am
How to download this file

Please help me How to download this file, no store in webroot

#5965 report it
micz at 2011/12/01 06:37am
Thanx for this extension

Thanx for this extension but please use <?php instead <? because if someone has short tags turned off error will occur.

#5512 report it
Rohit Duhan at 2011/10/17 04:51pm
Windows Server

Use DIRECTORY_SEPARATOR, instead of '/' on the line mentioned by the previous post. So it will be similar to this: $this->addZipItem($zip, realpath(dirname($item)).DIRECTORY_SEPARATOR, realpath($item));

#5214 report it
frizzo at 2011/09/22 11:29am
bug line 48

I've found a bug in line 48

incorrect: $this->addZipItem($zip, realpath(dirname($item)).'/', realpath($item).'/');

correct: $this->addZipItem($zip, realpath(dirname($item)).'/', realpath($item));

Maybe is useful for others

bye

Leave a comment

Please to leave your comment.

Create extension
Downloads
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: tigo
  • Category: Others
  • Votes: +10
  • Downloaded: 1,679 times
  • Created on: Jun 1, 2010
  • Last updated: Feb 15, 2011