2010-03-28 22:10:10 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 08:40:37 +00:00
|
|
|
<!-- $Revision$ -->
|
2008-01-21 21:54:18 +00:00
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="phar.getstub">
|
2007-01-28 05:31:52 +00:00
|
|
|
<refnamediv>
|
2008-01-21 15:23:52 +00:00
|
|
|
<refname>Phar::getStub</refname>
|
2007-01-28 05:31:52 +00:00
|
|
|
<refpurpose>Return the PHP loader or bootstrap stub of a Phar archive</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
|
|
|
<methodsynopsis>
|
2013-06-18 05:36:30 +00:00
|
|
|
<modifier>public</modifier> <type>string</type><methodname>Phar::getStub</methodname>
|
2007-01-28 05:31:52 +00:00
|
|
|
<void/>
|
|
|
|
</methodsynopsis>
|
|
|
|
|
|
|
|
<para>
|
2008-01-21 15:23:52 +00:00
|
|
|
Phar archives contain a bootstrap loader, or <literal>stub</literal>
|
|
|
|
written in PHP that is executed when the archive is executed in PHP either via
|
|
|
|
include:
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
include 'myphar.phar';
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
or by simple execution:
|
|
|
|
<screen>
|
|
|
|
<![CDATA[
|
|
|
|
php myphar.phar
|
|
|
|
]]>
|
|
|
|
</screen>
|
2007-01-28 05:31:52 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
</refsect1>
|
2021-06-11 08:01:17 +00:00
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
&no.function.parameters;
|
|
|
|
</refsect1>
|
|
|
|
|
2007-01-28 05:31:52 +00:00
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
Returns a string containing the contents of the bootstrap loader (stub) of
|
|
|
|
the current Phar archive.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
2007-02-03 04:03:09 +00:00
|
|
|
<refsect1 role="errors">
|
|
|
|
&reftitle.errors;
|
|
|
|
<para>
|
|
|
|
Throws <classname>RuntimeException</classname> if it is not possible to read
|
|
|
|
the stub from the Phar archive.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
2007-01-28 05:31:52 +00:00
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
|
|
|
<example>
|
2008-01-21 15:23:52 +00:00
|
|
|
<title>A <function>Phar::getStub</function> example</title>
|
2007-01-28 05:31:52 +00:00
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
2009-04-16 15:15:33 +00:00
|
|
|
<?php
|
2007-02-03 04:03:09 +00:00
|
|
|
$p = new Phar('/path/to/my.phar', 0, 'my.phar');
|
2007-01-28 05:31:52 +00:00
|
|
|
echo $p->getStub();
|
|
|
|
echo "==NEXT==\n";
|
2007-02-03 04:03:09 +00:00
|
|
|
$p->setStub("<?php
|
2007-01-28 05:31:52 +00:00
|
|
|
function __autoload($class)
|
|
|
|
{
|
|
|
|
include 'phar://' . str_replace('_', '/', $class);
|
|
|
|
}
|
|
|
|
Phar::mapPhar('myphar.phar');
|
|
|
|
include 'phar://myphar.phar/startup.php';
|
2008-01-21 15:23:52 +00:00
|
|
|
__HALT_COMPILER(); ?>");
|
2007-01-28 05:31:52 +00:00
|
|
|
echo $p->getStub();
|
2009-04-16 15:15:33 +00:00
|
|
|
?>
|
2007-01-28 05:31:52 +00:00
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
&example.outputs;
|
|
|
|
<screen>
|
|
|
|
<![CDATA[
|
2008-01-21 15:23:52 +00:00
|
|
|
<?php __HALT_COMPILER(); ?>
|
2007-01-28 05:31:52 +00:00
|
|
|
==NEXT==
|
|
|
|
<?php
|
|
|
|
function __autoload($class)
|
|
|
|
{
|
|
|
|
include 'phar://' . str_replace('_', '/', $class);
|
|
|
|
}
|
|
|
|
Phar::mapPhar('myphar.phar');
|
|
|
|
include 'phar://myphar.phar/startup.php';
|
2008-01-21 15:23:52 +00:00
|
|
|
__HALT_COMPILER(); ?>
|
2007-01-28 05:31:52 +00:00
|
|
|
]]>
|
|
|
|
</screen>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<para>
|
|
|
|
<simplelist>
|
2008-01-21 15:23:52 +00:00
|
|
|
<member><function>Phar::setStub</function></member>
|
|
|
|
<member><function>Phar::createDefaultStub</function></member>
|
2007-01-28 05:31:52 +00:00
|
|
|
</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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2007-01-28 05:31:52 +00:00
|
|
|
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
|
|
|
|
-->
|