php-doc-en/reference/phar/Phar/setAlias.xml
2013-06-18 05:36:30 +00:00

112 lines
2.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="phar.setalias" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Phar::setAlias</refname>
<refpurpose>Set the alias for the Phar archive</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>Phar::setAlias</methodname>
<methodparam><type>string</type><parameter>alias</parameter></methodparam>
</methodsynopsis>
&phar.write;
<para>
Set the alias for the Phar archive, and write it as the permanent alias
for this phar archive. An alias can be used internally to a phar archive to
ensure that use of the <literal>phar</literal> stream wrapper to access internal
files always works regardless of the location of the phar archive on the
filesystem. Another alternative is to rely upon Phar's interception of
<function>include</function> or to use <function>Phar::interceptFileFuncs</function>
and use relative paths.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>alias</parameter></term>
<listitem>
<para>
A shorthand string that this archive can be referred to in <literal>phar</literal>
stream wrapper access.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Throws <classname>UnexpectedValueException</classname> when write access
is disabled, and <classname>PharException</classname> if the alias is
already in use or any problems were encountered flushing changes to disk.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>Phar::setAlias</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
try {
$phar = new Phar('myphar.phar');
$phar->setAlias('myp.phar');
} catch (Exception $e) {
// handle error
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>Phar::__construct</function></member>
<member><function>Phar::interceptFileFuncs</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:"~/.phpdoc/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
-->