File_Archive

HomeFAQTutorialExamplesCompareDownloadsForum

File_Archive v1.4 released
The new version has been released with a lot of good stuff. (wildcards, cache for zip writer, simplified syntax...)

A forum has been created
You can discuss about File_Archive, ask some questions about it... in the newly created forum

File_Archive 1.3 is out
With File_Archive 1.3, you can now edit existing archives (add or remove files)

File_Archive 1.2 is out
File_Archive 1.2 now supports reading and writing to the following formats:
tar, tgz, tbz, bz2, gzip, ar, deb

File_Archive is now a PEAR package
pOOcl has been renamed File_Archive and is now part of PEAR.
See the PEAR page of File_Archive.


Valid XHTML 1.0! Valid CSS!

File_Archive is a PEAR package that will let you manipulate easily the tar, gz, bz2, tgz, tbz, zip, ar and deb files.
It lets you generate archives on the fly, write them as a file or in memory...

A few examples so that you see how File_Archive is easy to use

Extract a tar archive to a sub directory <?php
require_once "File/Archive.php";

File_Archive::extract(
    
//The content of archive.tar is extracted
    
$src "archive.tar/",

    
//And is written to folder archive
    
$dest "archive"
);
?>


Send a zip archive containing the content of a tar file to the standard output <?php
require_once "File/Archive.php";

File_Archive::extract(
    
//The content of archive.tar appears in the root folder (default argument)
    
$src "archive.tar/",

    
//And is written to ...
    
File_Archive::toArchive(       // ... a zip archive
        
"archive.zip",             // called archive.zip
        
File_Archive::toOutput()   // that will be sent to the standard output
    
)
);
?>


Output a file from an archive <?php
require_once "File/Archive.php";

//Note as the archives appear as folders
File_Archive::extract(
    
$src "archive.tar/inner.tgz/file.txt",
    
File_Archive::toOutput()
);

?>