Phar

from Wikipedia, the free encyclopedia

Phar ( PHP Archive ) is an extension in PHP that enables programs or files to be processed from a compressed archive file , similar to a Java Archive . Various compression methods are available for compressing the data itself, such as B. bzip2 , gzip or ZIP are available. The origin of Phar goes back to the PEAR package PHP_Archive . This later resulted in the extension based on the PECL library , Phar . Phar has been implemented natively in PHP since PHP version 5.3.0.

example

The usual integration of files is done by specifying an absolute or relative file path. In contrast, the so-called stream wrapper phar://must be specified for Phar files . As a result, the file is included after the archive name is slashed.

<?php

  // gewöhnliches Einbinden
  include '/path/to/external/file.php';

  // Einbinden über eine Archivdatei
  include 'phar:///path/to/myphar.phar/file.php';

?>

Web links

Individual evidence

  1. http://de.php.net/manual/de/migration53.new-extensions.php