reference/phar/Phar/webPhar.xml
5beaad9885973652023784f1a4656a5e497779fb
...
...
@@ -3,28 +3,27 @@
3
3
<refentry xml:id="phar.webphar" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
4
4
<refnamediv>
5
5
<refname>Phar::webPhar</refname>
6
-
<refpurpose>mapPhar for web-based phars. front controller for web applications</refpurpose>
6
+
<refpurpose>Routes a request from a web browser to an internal file within the phar archive</refpurpose>
7
7
</refnamediv>
8
8

9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
-
<methodsynopsis>
11
+
<methodsynopsis role="Phar">
12
12
<modifier>final</modifier> <modifier>public</modifier> <modifier>static</modifier> <type>void</type><methodname>Phar::webPhar</methodname>
13
-
<methodparam choice="opt"><type>string</type><parameter>alias</parameter></methodparam>
14
-
<methodparam choice="opt"><type>string</type><parameter>index</parameter><initializer>"index.php"</initializer></methodparam>
15
-
<methodparam choice="opt"><type>string</type><parameter>f404</parameter></methodparam>
16
-
<methodparam choice="opt"><type>array</type><parameter>mimetypes</parameter></methodparam>
17
-
<methodparam choice="opt"><type>callable</type><parameter>rewrites</parameter></methodparam>
13
+
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>alias</parameter><initializer>&null;</initializer></methodparam>
14
+
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>index</parameter><initializer>&null;</initializer></methodparam>
15
+
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>fileNotFoundScript</parameter><initializer>&null;</initializer></methodparam>
16
+
<methodparam choice="opt"><type>array</type><parameter>mimeTypes</parameter><initializer>[]</initializer></methodparam>
17
+
<methodparam choice="opt"><type class="union"><type>callable</type><type>null</type></type><parameter>rewrite</parameter><initializer>&null;</initializer></methodparam>
18
18
</methodsynopsis>
19
19
<para>
20
-
<function>Phar::mapPhar</function> for web-based phars. This method parses
21
-
<varname>$_SERVER['REQUEST_URI']</varname> and routes a request from a web
22
-
browser to an internal file within the phar archive. In essence, it simulates
23
-
a web server, routing requests to the correct file, echoing the correct headers
24
-
and parsing PHP files as needed. This powerful method is part of what makes it easy
25
-
to convert an existing PHP application into a phar archive. Combined with
26
-
<function>Phar::mungServer</function> and <function>Phar::interceptFileFuncs</function>,
27
-
any web application can be used unmodified from a phar archive.
20
+
<function>Phar::webPhar</function> serves as <function>Phar::mapPhar</function> for
21
+
web-based phars. This method parses <varname>$_SERVER['REQUEST_URI']</varname> and
22
+
routes a request from a web browser to an internal file within the phar archive.
23
+
It simulates a web server, routing requests to the correct file, echoing the correct
24
+
headers and parsing PHP files as needed. Combined with <function>Phar::mungServer</function>
25
+
and <function>Phar::interceptFileFuncs</function>, any web application can be used
26
+
unmodified from a phar archive.
28
27
</para>
29
28
<para>
30
29
<function>Phar::webPhar</function> should only be
...
...
@@ -55,7 +54,7 @@
55
54
</listitem>
56
55
</varlistentry>
57
56
<varlistentry>
58
-
<term><parameter>f404</parameter></term>
57
+
<term><parameter>fileNotFoundScript</parameter></term>
59
58
<listitem>
60
59
<para>
61
60
The location of the script to run when a file is not found. This
...
...
@@ -64,7 +63,7 @@
64
63
</listitem>
65
64
</varlistentry>
66
65
<varlistentry>
67
-
<term><parameter>mimetypes</parameter></term>
66
+
<term><parameter>mimeTypes</parameter></term>
68
67
<listitem>
69
68
<para>
70
69
An array mapping additional file extensions to MIME type.
...
...
@@ -122,7 +121,7 @@ $mimes = array(
122
121
</listitem>
123
122
</varlistentry>
124
123
<varlistentry>
125
-
<term><parameter>rewrites</parameter></term>
124
+
<term><parameter>rewrite</parameter></term>
126
125
<listitem>
127
126
<para>
128
127
The rewrites function is passed a string as its only parameter and must return a <type>string</type> or &false;.
...
...
@@ -155,11 +154,33 @@ $mimes = array(
155
154
Throws <classname>PharException</classname> when unable to open the internal
156
155
file to output, or if
157
156
called from a non-stub. If an invalid array value is passed into
158
-
<parameter>mimetypes</parameter> or an invalid callback is passed into <parameter>rewrites</parameter>, then
157
+
<parameter>mimeTypes</parameter> or an invalid callback is passed into <parameter>rewrite</parameter>, then
159
158
<classname>UnexpectedValueException</classname> is thrown.
160
159
</para>
161
160
</refsect1>
162
161

162
+
<refsect1 role="changelog">
163
+
&reftitle.changelog;
164
+
<informaltable>
165
+
<tgroup cols="2">
166
+
<thead>
167
+
<row>
168
+
<entry>&Version;</entry>
169
+
<entry>&Description;</entry>
170
+
</row>
171
+
</thead>
172
+
<tbody>
173
+
<row>
174
+
<entry>8.0.0</entry>
175
+
<entry>
176
+
<parameter>fileNotFoundScript</parameter> and <parameter>rewrite</parameter> are nullable now.
177
+
</entry>
178
+
</row>
179
+
</tbody>
180
+
</tgroup>
181
+
</informaltable>
182
+
</refsect1>
183
+

163
184
<refsect1 role="examples">
164
185
&reftitle.examples;
165
186
<para>
...
...
@@ -203,7 +224,6 @@ __HALT_COMPILER(); ?>');
203
224
</refsect1>
204
225

205
226
</refentry>
206
-

207
227
<!-- Keep this comment at the end of the file
208
228
Local variables:
209
229
mode: sgml
210
230