mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
initial docs for phar extension
# need sanity check, first time doing phpdoc git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@227468 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
e4815efcb8
commit
6a342aa5e1
25 changed files with 2245 additions and 0 deletions
21
reference/phar/functions.xml
Normal file
21
reference/phar/functions.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
&reference.phar.functions.Phar-construct;
|
||||
&reference.phar.functions.Phar-count;
|
||||
&reference.phar.functions.Phar-getModified;
|
||||
&reference.phar.functions.Phar-getVersion;
|
||||
&reference.phar.functions.Phar-loadPhar;
|
||||
&reference.phar.functions.Phar-mapPhar;
|
||||
&reference.phar.functions.Phar-offsetExists;
|
||||
&reference.phar.functions.Phar-offsetGet;
|
||||
&reference.phar.functions.Phar-offsetSet;
|
||||
&reference.phar.functions.Phar-offsetUnset;
|
||||
&reference.phar.functions.PharFileInfo-construct;
|
||||
&reference.phar.functions.PharFileInfo-getCRC32;
|
||||
&reference.phar.functions.PharFileInfo-getCompressedSize;
|
||||
&reference.phar.functions.PharFileInfo-getPharFlags;
|
||||
&reference.phar.functions.PharFileInfo-isCRCChecked;
|
||||
&reference.phar.functions.PharFileInfo-isCompressed;
|
||||
&reference.phar.functions.PharFileInfo-isCompressedBZIP2;
|
||||
&reference.phar.functions.PharFileInfo-isCompressedGZ;
|
||||
&reference.phar.functions.apiVersion;
|
||||
&reference.phar.functions.canCompress;
|
||||
&reference.phar.functions.canWrite;
|
113
reference/phar/functions/Phar-construct.xml
Normal file
113
reference/phar/functions/Phar-construct.xml
Normal file
|
@ -0,0 +1,113 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.Phar-construct">
|
||||
<refnamediv>
|
||||
<refname>Phar::__construct</refname>
|
||||
<refpurpose>Construct a Phar archive object</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>Phar::__construct</methodname>
|
||||
<methodparam><type>string</type><parameter>fname</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>alias</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>fname</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Path to an existing Phar archive, or if the
|
||||
<link linkend="ini.phar.readonly">phar.readonly</link> INI
|
||||
variable is set to "0",
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>flags</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
flags to pass to parent class <classname>RecursiveDirectoryIterator</classname>.
|
||||
See <ulink url="http://www.php.net/~helly/php/ext/spl/classRecursiveDirectoryIterator.html#be0e1176d512c66500e5c26f248c89c4">SPL RecursiveDirectoryIterator docs</ulink>
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>alias</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Alias with which this Phar archive should be referred to in calls to stream
|
||||
functionality.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="errors">
|
||||
&reftitle.errors;
|
||||
<para>
|
||||
Throws BadMethodCallException if called twice, UnexpectedValueException
|
||||
if the phar archive can't be opened.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>Phar::__construct</function> example</title>
|
||||
<para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
try {
|
||||
$p = new Phar('/path/to/my.phar', CURRENT_AS_FILEINFO | KEY_AS_FILENAME,
|
||||
'my.phar');
|
||||
} catch (UnexpectedValueException $e) {
|
||||
die('Could not open my.phar');
|
||||
} catch (BadMethodCallException $e) {
|
||||
echo 'technically, this cannot happen';
|
||||
}
|
||||
// this works now
|
||||
echo file_get_contents('phar://my.phar/example.txt');
|
||||
// and works as if we had typed
|
||||
echo file_get_contents('phar:///path/to/my.phar/example.txt');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
86
reference/phar/functions/Phar-count.xml
Normal file
86
reference/phar/functions/Phar-count.xml
Normal file
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.Phar-count">
|
||||
<refnamediv>
|
||||
<refname>Phar->count</refname>
|
||||
<refpurpose>Returns the number of entries (files) in the Phar archive</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>Phar->count</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
The number of files containd within this phar, or 0 (the number zero) if none.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>Phar->count</function> example</title>
|
||||
<para>
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// make sure it doesn't exist
|
||||
@unlink('brandnewphar.phar');
|
||||
try {
|
||||
$p = new Phar('brandnewphar.phar');
|
||||
} catch (Exception $e) {
|
||||
echo 'Could not create phar:', $e;
|
||||
}
|
||||
echo 'The new phar has ' . $p->count() . " entries\n";
|
||||
$p['file.txt'] = 'hi';
|
||||
echo 'The new phar has ' . $p->count() . " entries\n";
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
The new phar has 0 entries
|
||||
The new phar has 1 entries
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
55
reference/phar/functions/Phar-getModified.xml
Normal file
55
reference/phar/functions/Phar-getModified.xml
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.Phar-getModified">
|
||||
<refnamediv>
|
||||
<refname>Phar->getModified</refname>
|
||||
<refpurpose>Return whether phar was modified</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>Phar->getModified</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This method can be used to determine whether a phar has either
|
||||
had an internal file deleted, or contents of a file changed in
|
||||
some way.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&true; if the phar has been modified since opened, &false; if not
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
64
reference/phar/functions/Phar-getVersion.xml
Normal file
64
reference/phar/functions/Phar-getVersion.xml
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.Phar-getVersion">
|
||||
<refnamediv>
|
||||
<refname>Phar->getVersion</refname>
|
||||
<refpurpose>Return version info of Phar archive</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>Phar->getVersion</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
Returns the API version of an opened Phar archive.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
The opened archive's API version. This is not to be confused with
|
||||
the API version that the loaded phar extension will use to create
|
||||
new phars.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>Phar::apiVersion</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
115
reference/phar/functions/Phar-loadPhar.xml
Normal file
115
reference/phar/functions/Phar-loadPhar.xml
Normal file
|
@ -0,0 +1,115 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.Phar-loadPhar">
|
||||
<refnamediv>
|
||||
<refname>Phar::loadPhar</refname>
|
||||
<refpurpose>Loads any phar archive with an alias</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>Phar::loadPhar</methodname>
|
||||
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>alias</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This can be used to read the contents of an external Phar archive. This
|
||||
is most useful for assigning an alias to a phar so that subsequent references
|
||||
to the phar can use the shorter alias.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>filename</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
the full or relative path to the phar archive to open
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>alias</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The alias that may be used to refer to the phar archive. Note
|
||||
that many phar archives specify an explicit alias inside the
|
||||
phar archive, and an E_RECOVERABLE_ERROR will be thrown if
|
||||
a new alias is specified in this case.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
returns &true; if successful, &false; otherwise
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="errors">
|
||||
&reftitle.errors;
|
||||
<para>
|
||||
E_RECOVERABLE_ERROR is thrown if an alias is passed in and the phar archive
|
||||
already has an explicit alias
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>Phar::loadPhar</function> example</title>
|
||||
<para>
|
||||
loadPhar can be used anywhere to load an external Phar archive, whereas
|
||||
mapPhar should be used in a loader stub for a Phar.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
Phar::loadPhar('/path/to/phar.phar', 'my.phar');
|
||||
echo file_get_contents('phar://my.phar/file.txt');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>Phar::mapPhar</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
111
reference/phar/functions/Phar-mapPhar.xml
Normal file
111
reference/phar/functions/Phar-mapPhar.xml
Normal file
|
@ -0,0 +1,111 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.Phar-mapPhar">
|
||||
<refnamediv>
|
||||
<refname>Phar::mapPhar</refname>
|
||||
<refpurpose>Reads the currently executed file (a phar) and registers its manifest</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>mixed</type><methodname>Phar::mapPhar</methodname>
|
||||
<methodparam><type>string</type><parameter>alias</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This static method should be used inside a Phar archive's loader stub
|
||||
in order to initialize the phar.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>alias</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The alias with which this phar should be referred to.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="errors">
|
||||
&reftitle.errors;
|
||||
<para>
|
||||
E_RECOVERABLE_ERROR is thrown if not called directly within PHP execution,
|
||||
if no __HALT_COMPILER(); token is found in the current source file, or if
|
||||
the file cannot be opened for reading.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>Phar::mapPhar</function> example</title>
|
||||
<para>
|
||||
mapPhar should be used only inside a phar's loader stub. Use
|
||||
loadPhar to load an external phar into memory.
|
||||
</para>
|
||||
<para>
|
||||
Here is a sample Phar loader stub that uses mapPhar.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
function __autoload($class)
|
||||
{
|
||||
include 'phar://' . str_replace('_', '/', $class);
|
||||
}
|
||||
Phar::mapPhar('me.phar');
|
||||
include 'phar://me.phar/startup.php';
|
||||
__HALT_COMPILER();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>Phar::loadPhar</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
107
reference/phar/functions/Phar-offsetExists.xml
Normal file
107
reference/phar/functions/Phar-offsetExists.xml
Normal file
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.Phar-offsetExists">
|
||||
<refnamediv>
|
||||
<refname>Phar::offsetExists</refname>
|
||||
<refpurpose>determines whether a file exists in the phar</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>Phar::offsetExists</methodname>
|
||||
<methodparam><type>string</type><parameter>offset</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This is an implementation of the ArrayAccess interface allowing
|
||||
direct manipulation of the contents of a Phar archive using
|
||||
array access brackets.
|
||||
</para>
|
||||
<para>
|
||||
offsetExists() is called whenever <function>isset</function> is called.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>offset</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The filename (relative path) to look for in a Phar.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns &true; if the file exists within the phar, or &false; if not.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>Phar::offsetExists</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$p = new Phar('my.phar');
|
||||
$p['firstfile.txt'] = 'first file';
|
||||
$p['secondfile.txt'] = 'second file';
|
||||
// the next set of lines call offsetExists() indirectly
|
||||
var_dump(isset($p['firstfile.txt']));
|
||||
var_dump(isset($p['nothere.txt']));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
bool(true)
|
||||
bool(false)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="function.Phar-offsetGet"><function>Phar::offsetGet</function></link></member>
|
||||
<member><link linkend="function.Phar-offsetSet"><function>Phar::offsetSet</function></link></member>
|
||||
<member><link linkend="function.Phar-offsetUnset"><function>Phar::offsetUnset</function></link></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
122
reference/phar/functions/Phar-offsetGet.xml
Normal file
122
reference/phar/functions/Phar-offsetGet.xml
Normal file
|
@ -0,0 +1,122 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.Phar-offsetGet">
|
||||
<refnamediv>
|
||||
<refname>Phar::offsetGet</refname>
|
||||
<refpurpose>get a PharFileInfo object for a specific file</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>Phar::offsetGet</methodname>
|
||||
<methodparam><type>string</type><parameter>offset</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This is an implementation of the ArrayAccess interface allowing
|
||||
direct manipulation of the contents of a Phar archive using
|
||||
array access brackets. offsetGet is used for retrieving files from
|
||||
a Phar archive.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>offset</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The filename (relative path) to look for in a Phar.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
a <classname>PharFileInfo</classname> object is returned that can be used to
|
||||
iterate over a file's contents or to retrieve information about the current file.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="errors">
|
||||
&reftitle.errors;
|
||||
<para>
|
||||
This method throws <classname>BadMethodCallException</classname> if the file
|
||||
does not exist in the Phar archive.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>Phar::offsetGet</function> example</title>
|
||||
<para>
|
||||
As with all classes that implement the <classname>ArrayAccess</classname>
|
||||
interface, offsetGet is automatically called when using the [] angle bracket
|
||||
operator
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$p = new Phar('myphar.phar');
|
||||
$p['exists.txt'] = "file exists\n";
|
||||
try {
|
||||
// automatically calls offsetGet()
|
||||
echo $p['exists.txt'];
|
||||
echo $p['doesnotexist.txt'];
|
||||
} catch (BadMethodCallException $e) {
|
||||
echo $e;
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
file exists
|
||||
Entry doesnotexist.txt does not exist
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="function.Phar-offsetExists"><function>Phar::offsetExists</function></link></member>
|
||||
<member><link linkend="function.Phar-offsetSet"><function>Phar::offsetSet</function></link></member>
|
||||
<member><link linkend="function.Phar-offsetUnset"><function>Phar::offsetUnset</function></link></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
118
reference/phar/functions/Phar-offsetSet.xml
Normal file
118
reference/phar/functions/Phar-offsetSet.xml
Normal file
|
@ -0,0 +1,118 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.Phar-offsetSet">
|
||||
<refnamediv>
|
||||
<refname>Phar::offsetSet</refname>
|
||||
<refpurpose>set the contents of an internal file to those of an external file</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>Phar::offsetSet</methodname>
|
||||
<methodparam><type>string</type><parameter>offset</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>value</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This is an implementation of the ArrayAccess interface allowing
|
||||
direct manipulation of the contents of a Phar archive using
|
||||
array access brackets. offsetSet is used for modifying an
|
||||
existing file, or adding a new file to a Phar archive.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>offset</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The filename (relative path) to modify in a Phar.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>value</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Its description
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
no return values
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="errors">
|
||||
&reftitle.errors;
|
||||
<para>
|
||||
if <link linkend="ini.phar.readonly">phar.readonly</link> is <literal>1</literal>,
|
||||
<classname>BadMethodCallException</classname> is thrown, as modifying a Phar
|
||||
is only allowed when phar.readonly is set to <literal>0</literal>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>Phar::offsetSet</function> example</title>
|
||||
<para>
|
||||
offsetSet should not be accessed directly, but instead used
|
||||
via array access with the [] operator.
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
|
||||
// calls offsetSet
|
||||
$p['file.txt'] = 'Hi there';
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="function.Phar-offsetExists"><function>Phar::offsetExists</function></link></member>
|
||||
<member><link linkend="function.Phar-offsetGet"><function>Phar::offsetGet</function></link></member>
|
||||
<member><link linkend="function.Phar-offsetUnset"><function>Phar::offsetUnset</function></link></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
95
reference/phar/functions/Phar-offsetUnset.xml
Normal file
95
reference/phar/functions/Phar-offsetUnset.xml
Normal file
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.Phar-offsetUnset">
|
||||
<refnamediv>
|
||||
<refname>Phar::offsetUnset</refname>
|
||||
<refpurpose>remove a file from a phar</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>Phar::offsetUnset</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This is an implementation of the ArrayAccess interface allowing
|
||||
direct manipulation of the contents of a Phar archive using
|
||||
array access brackets. offsetUnset is used for deleting an
|
||||
existing file, and is called by the <function>unset</function>
|
||||
language construct.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&true; if successful, &false; on failure
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="errors">
|
||||
&reftitle.errors;
|
||||
<para>
|
||||
if <link linkend="ini.phar.readonly">phar.readonly</link> is <literal>1</literal>,
|
||||
<classname>BadMethodCallException</classname> is thrown, as modifying a Phar
|
||||
is only allowed when phar.readonly is set to <literal>0</literal>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>Phar::offsetUnset</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
|
||||
// deletes file.txt from my.phar by calling offsetUnset
|
||||
unset($p['file.txt']);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="function.Phar-offsetGet"><function>Phar::offsetExists</function></link></member>
|
||||
<member><link linkend="function.Phar-offsetGet"><function>Phar::offsetGet</function></link></member>
|
||||
<member><link linkend="function.Phar-offsetGet"><function>Phar::offsetSet</function></link></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
111
reference/phar/functions/PharFileInfo-construct.xml
Normal file
111
reference/phar/functions/PharFileInfo-construct.xml
Normal file
|
@ -0,0 +1,111 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.PharFileInfo-construct">
|
||||
<refnamediv>
|
||||
<refname>PharFileInfo::__construct</refname>
|
||||
<refpurpose>Construct a Phar entry object</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>PharFileInfo::__construct</methodname>
|
||||
<methodparam><type>string</type><parameter>entry</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This should not be called directly. Instead, a PharFileInfo object
|
||||
is initialized by calling <function>Phar::offsetGet</function>
|
||||
through array access.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>entry</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The full url to retrieve a file. If you wish to retrieve the information
|
||||
for the file <literal>my/file.php</literal> from the phar <literal>boo.phar</literal>,
|
||||
the entry should be <literal>phar://boo.phar/my/file.php</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="errors">
|
||||
&reftitle.errors;
|
||||
<para>
|
||||
Throws <classname>BadMethodCallException</classname> if
|
||||
<function>__construct</function> is called twice.
|
||||
Throws <classname>UnexpectedValueException</classname> if
|
||||
the phar URL requested is malformed, the requested
|
||||
phar cannot be opened, or the file can't be found within the phar.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>PharFileInfo::__construct</function> example</title>
|
||||
<para>
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
|
||||
$p['testfile.txt'] = "hi\nthere\ndude";
|
||||
$file = $p['testfile.txt'];
|
||||
foreach ($file as $line => $text) {
|
||||
echo "line number $line: $text";
|
||||
}
|
||||
// this also works
|
||||
$file = new PharFileInfo('phar:///path/to/my.phar/testfile.txt');
|
||||
foreach ($file as $line => $text) {
|
||||
echo "line number $line: $text";
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
line number 1: hi
|
||||
line number 2: there
|
||||
line number 3: dude
|
||||
line number 1: hi
|
||||
line number 2: there
|
||||
line number 3: dude
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
76
reference/phar/functions/PharFileInfo-getCRC32.xml
Normal file
76
reference/phar/functions/PharFileInfo-getCRC32.xml
Normal file
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.PharFileInfo-getCRC32">
|
||||
<refnamediv>
|
||||
<refname>PharFileInfo->getCRC32</refname>
|
||||
<refpurpose>Returns CRC32 code or throws an exception if not CRC checked</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>PharFileInfo->getCRC32</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This returns the <function>crc32</function> checksum of the file
|
||||
within the Phar archive.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
the <function>crc32</function> checksum of the file within the Phar archive.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>PharFileInfo->getCRC32</function> example</title>
|
||||
<para>
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$p = new Phar('my.phar');
|
||||
$p['myfile.txt'] = 'hi';
|
||||
$file = $p['myfile.txt'];
|
||||
echo $file->getCRC32();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
3633523372
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
83
reference/phar/functions/PharFileInfo-getCompressedSize.xml
Normal file
83
reference/phar/functions/PharFileInfo-getCompressedSize.xml
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.PharFileInfo-getCompressedSize">
|
||||
<refnamediv>
|
||||
<refname>PharFileInfo->getCompressedSize</refname>
|
||||
<refpurpose>Returns the actual size of the file (with compression) inside the Phar archive</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>PharFileInfo->getCompressedSize</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This returns the size of the file within the Phar archive. Uncompressed files will return
|
||||
the same value for getCompressedSize as they will with <function>filesize</function>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
the size in bytes of the file within the Phar archive on disk.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>PharFileInfo->getCompressedSize</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$p = new Phar('my.phar');
|
||||
$p['myfile.txt'] = 'hi';
|
||||
$file = $p['myfile.txt'];
|
||||
echo $file->getCompressedSize();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
2
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="function.PharFileInfo-isCompressed"><function>PharFileInfo->isCompressed</function></link></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
73
reference/phar/functions/PharFileInfo-getPharFlags.xml
Normal file
73
reference/phar/functions/PharFileInfo-getPharFlags.xml
Normal file
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.PharFileInfo-getPharFlags">
|
||||
<refnamediv>
|
||||
<refname>PharFileInfo->getPharFlags</refname>
|
||||
<refpurpose>Returns the Phar file entry flags</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>PharFileInfo->getPharFlags</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This returns the size of the file within the Phar archive. Uncompressed files will return
|
||||
the same value for getCompressedSize as they will with <function>filesize</function>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
the size in bytes of the file within the Phar archive on disk.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>PharFileInfo->getPharFlags</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$p = new Phar('my.phar');
|
||||
$p['myfile.txt'] = 'hi';
|
||||
$file = $p['myfile.txt'];
|
||||
var_dump($file->getPharFlags());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
int(0)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
74
reference/phar/functions/PharFileInfo-isCRCChecked.xml
Normal file
74
reference/phar/functions/PharFileInfo-isCRCChecked.xml
Normal file
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.PharFileInfo-isCRCChecked">
|
||||
<refnamediv>
|
||||
<refname>PharFileInfo::isCRCChecked</refname>
|
||||
<refpurpose>Returns whether file entry has had its CRC verified</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>PharFileInfo->isCRCChecked</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This returns whether a file within a Phar archive
|
||||
has had its CRC verified.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&true; if the file has had its CRC verified, &false; if not.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>PharFileInfo->isCRCChecked</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$p = new Phar('my.phar');
|
||||
$p['myfile.txt'] = 'hi';
|
||||
$file = $p['myfile.txt'];
|
||||
var_dump($file->isCRCChecked());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
bool(true)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
85
reference/phar/functions/PharFileInfo-isCompressed.xml
Normal file
85
reference/phar/functions/PharFileInfo-isCompressed.xml
Normal file
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.PharFileInfo-isCompressed">
|
||||
<refnamediv>
|
||||
<refname>PharFileInfo->isCompressed</refname>
|
||||
<refpurpose>Returns whether the entry is compressed</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PharFileInfo->isCompressed</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This returns whether a file is compressed within a Phar archive
|
||||
with either Gzip or Bzip2 compression.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&true; if the file is compressed within the Phar archive, &false; if not.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>PharFileInfo->isCompressed</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$p = new Phar('my.phar');
|
||||
$p['myfile.txt'] = 'hi';
|
||||
$file = $p['myfile.txt'];
|
||||
var_dump($file->isCompressed());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
bool(false)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="function.PharFileInfo-getCompressedSize"><function>PharFileInfo->getCompressedSize</function></link></member>
|
||||
<member><link linkend="function.PharFileInfo-isCompressedGZ"><function>PharFileInfo->isCompressedGZ</function></link></member>
|
||||
<member><link linkend="function.PharFileInfo-isCompressedBZIP2"><function>PharFileInfo->isCompressedBZIP2</function></link></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
85
reference/phar/functions/PharFileInfo-isCompressedBZIP2.xml
Normal file
85
reference/phar/functions/PharFileInfo-isCompressedBZIP2.xml
Normal file
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.PharFileInfo-isCompressedBZIP2">
|
||||
<refnamediv>
|
||||
<refname>PharFileInfo->isCompressedBZIP2</refname>
|
||||
<refpurpose>Returns whether the entry is compressed using bzip2</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PharFileInfo->isCompressedBZIP2</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This returns whether a file is compressed within a Phar archive
|
||||
with Bzip2 compression.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&true; if the file is compressed within the Phar archive using Bzip2, &false; if not.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>PharFileInfo->isCompressedBZIP2</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$p = new Phar('my.phar');
|
||||
$p['myfile.txt'] = 'hi';
|
||||
$file = $p['myfile.txt'];
|
||||
var_dump($file->isCompressedBZIP2());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
bool(false)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="function.PharFileInfo-getCompressedSize"><function>PharFileInfo->getCompressedSize</function></link></member>
|
||||
<member><link linkend="function.PharFileInfo-isCompressedGZ"><function>PharFileInfo->isCompressedGZ</function></link></member>
|
||||
<member><link linkend="function.PharFileInfo-isCompressed"><function>PharFileInfo->isCompressed</function></link></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
85
reference/phar/functions/PharFileInfo-isCompressedGZ.xml
Normal file
85
reference/phar/functions/PharFileInfo-isCompressedGZ.xml
Normal file
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.PharFileInfo-isCompressedGZ">
|
||||
<refnamediv>
|
||||
<refname>PharFileInfo->isCompressedGZ</refname>
|
||||
<refpurpose>Returns whether the entry is compressed using gz</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>PharFileInfo->isCompressedGZ</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This returns whether a file is compressed within a Phar archive
|
||||
with Gzip compression.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&true; if the file is compressed within the Phar archive using Gzip, &false; if not.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>PharFileInfo->isCompressedGZ</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$p = new Phar('my.phar');
|
||||
$p['myfile.txt'] = 'hi';
|
||||
$file = $p['myfile.txt'];
|
||||
var_dump($file->isCompressedGZ());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
bool(false)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="function.PharFileInfo-getCompressedSize"><function>PharFileInfo->getCompressedSize</function></link></member>
|
||||
<member><link linkend="function.PharFileInfo-isCompressedBZIP2"><function>PharFileInfo->isCompressedBZIP2</function></link></member>
|
||||
<member><link linkend="function.PharFileInfo-isCompressed"><function>PharFileInfo->isCompressed</function></link></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
76
reference/phar/functions/apiVersion.xml
Normal file
76
reference/phar/functions/apiVersion.xml
Normal file
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.apiVersion">
|
||||
<refnamediv>
|
||||
<refname>apiVersion</refname>
|
||||
<refpurpose>Returns the api version</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>apiVersion</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
Return the API version of the phar file format that will be
|
||||
used when creating phars. The Phar extension supports reading API
|
||||
version 1.0.0 or newer.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
The API version string as in <literal>"1.0.0"</literal>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>Phar::apiVersion</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
echo Phar::apiVersion();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
1.0.0
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
84
reference/phar/functions/canCompress.xml
Normal file
84
reference/phar/functions/canCompress.xml
Normal file
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.canCompress">
|
||||
<refnamediv>
|
||||
<refname>canCompress</refname>
|
||||
<refpurpose>Returns whether phar extension supports compression using zlib or bzip2</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>canCompress</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This should be used to test whether compression is possible prior to
|
||||
loading a phar archive containing compressed files.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&true; if compression/decompression is available, &false; if not
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>canCompress</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
if (Phar::canCompress()) {
|
||||
echo file_get_contents('phar://whatever.phar/internal/file.txt');
|
||||
} else {
|
||||
echo 'no compression available';
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>PharFileInfo::isCompressed</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
83
reference/phar/functions/canWrite.xml
Normal file
83
reference/phar/functions/canWrite.xml
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.canWrite">
|
||||
<refnamediv>
|
||||
<refname>canWrite</refname>
|
||||
<refpurpose>Returns whether phar extension supports writing and creating phars</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>canWrite</methodname>
|
||||
<void/>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
This method determines whether write access has been disabled in
|
||||
the system php.ini via the <link linkend="ini.phar.readonly">phar.readonly</link>
|
||||
ini variable.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
&true; if write access is enabled, &false; if it is disabled.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>A <function>Phar::canWrite</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
if (Phar::canWrite()) {
|
||||
file_put_contents('phar://myphar.phar/file.txt', 'hi there');
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><link linkend="ini.phar.readonly">phar.readonly</link></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
106
reference/phar/ini.xml
Normal file
106
reference/phar/ini.xml
Normal file
|
@ -0,0 +1,106 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<section id="phar.configuration">
|
||||
&reftitle.runtime;
|
||||
&extension.runtime;
|
||||
<para>
|
||||
<table>
|
||||
<title>Filesystem and Streams Configuration Options</title>
|
||||
<tgroup cols="4">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Name</entry>
|
||||
<entry>Default</entry>
|
||||
<entry>Changeable</entry>
|
||||
<entry>Changelog</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>phar.readonly</entry>
|
||||
<entry>"1"</entry>
|
||||
<entry>PHP_INI_SYSTEM</entry>
|
||||
<entry>Available Since version 1.0.0</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>phar.require_hash</entry>
|
||||
<entry>"0"</entry>
|
||||
<entry>PHP_INI_SYSTEM disable/enable, PHP_INI_ALL enable</entry>
|
||||
<entry>Available Since version 1.0.0</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
</para>
|
||||
|
||||
&ini.descriptions.title;
|
||||
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry id="ini.phar.readonly">
|
||||
<term>
|
||||
<parameter>phar.readonly</parameter>
|
||||
<type>boolean</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
This option disables creation or modification of Phar archives
|
||||
using the <literal>phar</literal> stream or <classname>Phar</classname>
|
||||
object's write support. This setting should always be enabled on
|
||||
production machines, as the phar extension's convenient write support
|
||||
could allow straightforward creation of a php-based virus when coupled
|
||||
with other common security vulnerabilities.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
This setting can only be set in php.ini due to security reasons.
|
||||
</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry id="ini.phar.require-hash">
|
||||
<term>
|
||||
<parameter>phar.require_hash</parameter>
|
||||
<type>boolean</type>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
This option will force all opened Phar archives to contain some
|
||||
kind of signature (currently md5 and sha1 are supported), and will
|
||||
refuse to process any Phar archive that does not contain a signature.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
The option can be disabled in the system level only, but can be
|
||||
enabled using <function>ini_set</function> in a user script regardless
|
||||
of the system setting.
|
||||
</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
133
reference/phar/installation.xml
Normal file
133
reference/phar/installation.xml
Normal file
|
@ -0,0 +1,133 @@
|
|||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<section id="phar.installation">
|
||||
&reftitle.install;
|
||||
<simpara>
|
||||
<emphasis>Windows</emphasis> binaries may be found at
|
||||
<ulink url="&url.php.snapshots;">&url.php.snapshots;</ulink>.
|
||||
To install, download php_phar.dll to the folder specified
|
||||
by your php.ini file's <literal>extension_dir</literal> directive.
|
||||
Enable it by adding <literal>extension=php_phar.dll</literal>
|
||||
to your php.ini and restarting your webserver.
|
||||
</simpara>
|
||||
|
||||
<screen>
|
||||
<![CDATA[
|
||||
extension_dir=c:/php5/exts/
|
||||
extension=php_phar.dll
|
||||
]]>
|
||||
</screen>
|
||||
|
||||
<simpara>
|
||||
<emphasis>Linux, BSD, and other *nix variants</emphasis>
|
||||
can be compiled using the following steps:
|
||||
</simpara>
|
||||
|
||||
<itemizedlist>
|
||||
|
||||
<listitem>
|
||||
<simpara>
|
||||
Either:
|
||||
</simpara>
|
||||
<para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Run the pear installer for PECL/phar: <literal>pecl install phar</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<simpara>
|
||||
Copy <literal>phar.so</literal> from the directory indicated by the
|
||||
build process to the location specified in your php.ini file under
|
||||
<literal>extension_dir</literal>.
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<simpara>
|
||||
Add <literal>extension=phar.so</literal> to your php.ini
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<simpara>
|
||||
Or:
|
||||
</simpara>
|
||||
<para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Set the path to your php.ini via:
|
||||
</simpara>
|
||||
<simpara>
|
||||
<literal>pecl config-set php_ini /path/to/php.ini</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<simpara>
|
||||
Run the pear installer for PECL/phar: <literal>pecl install phar</literal>
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<simpara>
|
||||
Restart your webserver to reload your php.ini settings.
|
||||
</simpara>
|
||||
</listitem>
|
||||
|
||||
</itemizedlist>
|
||||
|
||||
<note>
|
||||
<title>Development Versions</title>
|
||||
<simpara>
|
||||
There are currently no <literal>stable</literal> versions of PECL/phar,
|
||||
to force installation of the <literal>alpha</literal> version of PECL/phar
|
||||
execute: <literal>pecl install phar-</literal><emphasis>alpha</emphasis>
|
||||
</simpara>
|
||||
</note>
|
||||
|
||||
<tip>
|
||||
<title>Compiling PECL/phar without using the PEAR command</title>
|
||||
<simpara>
|
||||
Rather than using <literal>pecl install phar</literal> to automatically
|
||||
download and install PECL/phar, you may download the tarball from
|
||||
<ulink url="&url.pecl.package;phar">PECL</ulink>.
|
||||
From the root of the unpacked tarball, run:
|
||||
<literal>phpize && ./configure --enable-phar && make</literal>
|
||||
to generate <literal>phar.so</literal>.
|
||||
Once built, continue the installation from step 4 above.
|
||||
</simpara>
|
||||
</tip>
|
||||
|
||||
<simpara>
|
||||
&pecl.info;
|
||||
<ulink url="&url.pecl.package;phar">&url.pecl.package;phar</ulink>.
|
||||
</simpara>
|
||||
</section>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
84
reference/phar/reference.xml
Normal file
84
reference/phar/reference.xml
Normal file
|
@ -0,0 +1,84 @@
|
|||
<?xml version = '1.0' encoding = 'iso-8859-1'?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- Purpose: -->
|
||||
<!-- Membership: pecl -->
|
||||
<reference id="ref.phar" >
|
||||
<title>Phar archive stream and classes</title>
|
||||
<titleabbrev>phar</titleabbrev>
|
||||
<partintro>
|
||||
<section id="phar.intro" >
|
||||
&reftitle.intro;
|
||||
<para>
|
||||
The phar extension
|
||||
provides the <literal>phar</literal> stream wrapper and the <classname>Phar</classname>
|
||||
class for manipulating self-contained PHP Archive (phar) files. The
|
||||
Phar class can be used to create and to extract contents of phar files as
|
||||
well as iterating over their contents.
|
||||
</para>
|
||||
<para>
|
||||
PHP Archive files are special collections of files that can be transparently
|
||||
run right out of the file, similar to Java's jar archive files. Using a phar archive,
|
||||
it is possible to distribute a complete PHP application in a single file. Phar
|
||||
archives can also be used to store files for extraction similar to tar or zip
|
||||
archive files.
|
||||
</para>
|
||||
</section>
|
||||
<section id="phar.requirements" >
|
||||
&reftitle.required;
|
||||
<para>
|
||||
Phar requires PHP 5.2.0 or newer, and requires that the
|
||||
<link linkend="ref.spl">SPL</link> extension
|
||||
be built into PHP.
|
||||
</para>
|
||||
<para>
|
||||
You may optionally wish to enable the <link linkend="ref.zlib" >zlib</link>
|
||||
and <link linkend="ref.bzip2" >bzip2</link> extensions to take
|
||||
advantage of compressed phar support. In addition, the
|
||||
<link linkend="ref.hash" >hash</link> extension can be
|
||||
used for signing phars and verifying integrity.
|
||||
</para>
|
||||
</section>
|
||||
&reference.phar.installation;
|
||||
<!-- Information found in configure.xml -->
|
||||
<!-- reference.phar.configure; -->
|
||||
<!-- Information found in ini.xml -->
|
||||
&reference.phar.ini;
|
||||
<section id="phar.resources" >
|
||||
&reftitle.resources;
|
||||
<para>
|
||||
|
||||
</para>
|
||||
&no.resource;
|
||||
</section>
|
||||
<section>
|
||||
<title>Classes</title>
|
||||
<simplelist>
|
||||
<member>
|
||||
<classname>Phar</classname>
|
||||
<classname>PharFileInfo</classname>
|
||||
</member>
|
||||
</simplelist>
|
||||
</section>
|
||||
</partintro>
|
||||
&reference.phar.functions;
|
||||
</reference>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"../../../manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
Loading…
Reference in a new issue