phar

 

介紹

provides a way to put entire PHP applications into a single file called a "phar" (PHP Archive) for easy distribution and installation.

Phar can compress individual files or an entire archive using gzip compression or bzip2 compression

verify archive integrity automatically through the use of MD5 ...

Usage

<?php
  include '/path/to/external/file.php';
?>

改寫成

<?php
  include 'phar:///path/to/myphar.phar/file.php';
?>

php.ini

# This option disables creation or modification of Phar archives using the phar stream or Phar object's write support.
phar.readonly 1

# force all opened Phar archives to contain some kind of signature ( MD5 ...)
phar.require_hash 1

# Allows mapping phar archives to be pre-parsed at web server startup, providing a performance improvement
phar.cache_list =/path/to/phar1.phar:/path/to/phar2.phar

 

Creative Commons license icon Creative Commons license icon