Download the PHP package kiwilan/php-archive without Composer

On this page you can find all versions of the php package kiwilan/php-archive. 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 php-archive

PHP Archive

Banner with archives picture in background and PHP Archive title

php version downloads license tests codecov

PHP package to handle archives (.zip, .rar, .tar, .7z, .pdf) with unified API and hybrid solution (native/p7zip), designed to works with EPUB and CBA (.cbz, .cbr, .cb7, .cbt).

Supports Linux, macOS and Windows.

[!WARNING]

For some formats (.rar and .7z) rar PHP extension or p7zip binary could be necessary, see Requirements.

Requirements

Type Supported Requirement Uses
.zip, .epub, .cbz N/A Uses zip extension
.tar, .tar.gz, .cbt N/A Uses phar extension*
.rar, .cbr rar PHP extension or p7zip binary PHP rar or p7zip
.7z, .cb7 p7zip binary p7zip binary
.pdf Optional (for extraction) imagick PHP extension smalot/pdfparser

*: for .tar archives with password, .7z will be used because extension don't support password.

[!NOTE]

Here you can read some installation guides for dependencies

[!WARNING]

  • On macOS, for .rar extract, you have to install rar binary to extract files, p7zip not support .rar extraction.
  • On Windows, for .pdf extract, imagick PHP extension have to work but my tests failed on this feature. So to extract PDF pages I advice to use WSL.

If you want more information, you can read section About.

Features

Installation

You can install the package via composer:

Usage

Read and extract

With archive file (.zip, .rar, .tar, .7z, epub, cbz, cbr, cb7, cbt, tar.gz, .pdf).

PDF files works with same API than archives but with some differences.

Read from string

You can read archive from string with readFromString method.

This method will try to detect the format of the archive from the string. If you have an error, you can use readFromString method with third argument to specify the format of the archive.

Password protected

You can read password protected archives with read or readFromString method.

[!WARNING]

Works only with archives and not with PDF files.

Override binary path

For p7zip binary, you can override the path with overrideBinaryPath method.

Stat

From stat PHP function: https://www.php.net/manual/en/function.stat.php

Gives information about a file

Create

You can create archive with method Archive::make method.

Works only with .zip archives.

Edit

You can edit archive with same method Archive::make method.

Testing

About

This package was inspired by this excellent post on StackOverflow which make state of the art of PHP archive handling. The package Gemorroj/Archive7z was also a good source of inspiration cause it's the only package that handle .7z archives with wrapper of p7zip fork binary. But I would to handle all main archives formats with native PHP solution it possible, and use p7zip binary only if native solution is not available.

State of the art of PHP archive handling:

Type Is native Solution
ZIP Native
TAR Native
RAR rar or p7zip binary
7ZIP p7zip binary
PDF smalot/pdfparser

Why not full wrapper of p7zip binary?

This solution is used by Gemorroj/Archive7z, and it works well. But another problem is the usage of the p7zip fork which is not the official p7zip binary and can be difficult to install on some systems.

PHP can handle natively some archive formats, but not all. So I choose to use native PHP solution when it's possible, and use p7zip binary with official version when it's not possible.

Case of rar

The rar PHP extension is not installed by default on PHP, developers have to install it manually. This extension is not actively maintained and users could have some compilation problems. To install it with PHP 8.1 or 8.2, it's necessary to compile manually the extension, you could read this guide if you want to install it (for PHP 8.2, you will have a warning message but it's not a problem, the extension will work).

But rar PHP extension is a problem because it's not sure to have a compatibility with future PHP versions. So I choose to handle rar archives with p7zip binary if rar PHP extension is not installed.

Case of 7zip

PHP can't handle .7z archives natively, so I choose to use p7zip binary. You will have to install it on your system to use this package. You could read this guide if you want to install it.

Case of pdf

PHP can't handle .pdf archives natively, so I choose to use smalot/pdfparser package, embedded in this package. To extract pages as images, you have to install imagick extension you could read this guide if you want to install it.

eBooks and comics

This package can handle .epub, .cbz, .cbr, .cb7, .cbt archives, it's depends on the extension, check requirements section.

More

Alternatives:

Documentation:

Changelog

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

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of php-archive with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
smalot/pdfparser Version ^2.4
spatie/temporary-directory Version ^2.1
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 kiwilan/php-archive contains the following files

Loading the files please wait ....