1PHAR(1) User Commands PHAR(1)
2
3
4
6 phar, phar.phar - PHAR (PHP archive) command line tool
7
9 phar <command> [options] ...
10
12 The PHAR file format provides a way to put entire PHP applications into
13 a single file called a "phar" (PHP Archive) for easy distribution and
14 installation.
15
16 With the phar command you can create, update or extract PHP archives.
17
18 Commands: add compress delete extract help help-list info list meta-del
19 meta-get meta-set pack sign stub-get stub-set tree version
20
21
23 Add entries to a PHAR package.
24
25 Required arguments:
26
27 -f file Specifies the phar file to work on.
28
29 ... Any number of input files and directories. If -i is in
30 use then ONLY files and matching the given regular
31 expression are being packed. If -x is given then files
32 matching that regular expression are NOT being packed.
33
34 Optional arguments:
35
36 -a alias Provide an alias name for the phar file.
37
38 -c algo Compression algorithm (see COMPRESSION )
39
40 -i regex Specifies a regular expression for input files.
41
42 -l level Number of preceding subdirectories to strip from file
43 entries
44
45 -x regex Regular expression for input files to exclude.
46
47
49 Compress or uncompress all files or a selected entry.
50
51 Required arguments:
52
53 -c algo Compression algorithm (see COMPRESSION )
54
55 -f file Specifies the phar file to work on.
56
57 Optional arguments:
58
59 -e entry Name of entry to work on (must include PHAR internal
60 directory name if any).
61
62
64 Delete entry from a PHAR archive
65
66 Required arguments:
67
68 -e entry Name of entry to work on (must include PHAR internal
69 directory name if any).
70
71 -f file Specifies the phar file to work on.
72
73
75 Extract a PHAR package to a directory.
76
77 Required arguments:
78
79 -f file Specifies the phar file to work on.
80
81 Optional arguments:
82
83 -i regex Specifies a regular expression for input files.
84
85 -x regex Regular expression for input files to exclude.
86
87 ... Directory to extract to (defaults to '.').
88
89
90
92 This help or help for a selected command.
93
94 Optional arguments:
95
96 ... Optional command to retrieve help for.
97
98
100 Lists available commands.
101
102
104 Get information about a PHAR package.
105
106 By using -k it is possible to return a single value.
107
108 Required arguments:
109
110 -f file Specifies the phar file to work on.
111
112 Optional arguments:
113
114 -k index Subscription index to work on.
115
116
118 List contents of a PHAR archive.
119
120 Required arguments:
121
122 -f file Specifies the phar file to work on.
123
124 Optional arguments:
125
126 -i regex Specifies a regular expression for input files.
127
128 -x regex Regular expression for input files to exclude.
129
130
131
133 Delete meta information of a PHAR entry or a PHAR package.
134
135 If -k is given then the metadata is expected to be an array and the
136 given index is being deleted.
137
138 If something was deleted the return value is 0 otherwise it is 1.
139
140 Required arguments:
141
142 -f file Specifies the phar file to work on.
143
144 Optional arguments:
145
146 -e entry Name of entry to work on (must include PHAR internal
147 directory name if any).
148
149 -k index Subscription index to work on.
150
151
153 Get meta information of a PHAR entry or a PHAR package in serialized
154 from. If no output file is specified for meta data then stdout is being
155 used. You can also specify a particular index using -k. In that case
156 the metadata is expected to be an array and the value of the given
157 index is returned using echo rather than using serialize. If that index
158 does not exist or no meta data is present then the return value is 1.
159
160 Required arguments:
161
162 -f file Specifies the phar file to work on.
163
164 Optional arguments:
165
166 -e entry Name of entry to work on (must include PHAR internal
167 directory name if any).
168
169 -k index Subscription index to work on.
170
171
173 Set meta data of a PHAR entry or a PHAR package using serialized input.
174 If no input file is specified for meta data then stdin is being used.
175 You can also specify a particular index using -k. In that case the
176 metadata is expected to be an array and the value of the given index is
177 being set. If the metadata is not present or empty a new array will be
178 created. If the metadata is present and a flat value then the return
179 value is 1. Also using -k the input is been taken directly rather then
180 being serialized.
181
182 Required arguments:
183
184 -f file Specifies the phar file to work on.
185
186 -m meta Meta data to store with entry (serialized php data).
187
188 Optional arguments:
189
190 -e entry Name of entry to work on (must include PHAR internal
191 directory name if any).
192
193 -k index Subscription index to work on.
194
195
197 Pack files into a PHAR archive.
198
199 When using -s <stub>, then the stub file is being excluded from the
200 list of input files/dirs.To create an archive that contains PEAR class
201 PHP_Archive then point -p argument to PHP/Archive.php.
202
203 Required arguments:
204
205 -f file Specifies the phar file to work on.
206
207 ... Any number of input files and directories. If -i is in
208 use then ONLY files and matching the given regular
209 expression are being packed. If -x is given then files
210 matching that regular expression are NOT being packed.
211
212 Optional arguments:
213
214 -a alias Provide an alias name for the phar file.
215
216 -b bang Hash-bang line to start the archive (e.g.
217 #!/usr/bin/php). The hash mark itself '#!' and the new‐
218 line character are optional.
219
220 -c algo Compression algorithm (see COMPRESSION )
221
222 -h hash Selects the hash algorithm (see HASH )
223
224 -i regex Specifies a regular expression for input files.
225
226 -l level Number of preceding subdirectories to strip from file
227 entries
228
229 -p loader Location of PHP_Archive class file (pear list-files
230 PHP_Archive).You can use '0' or '1' to locate it auto‐
231 matically using the mentioned pear command. When using
232 '0' the command does not error out when the class file
233 cannot be located. This switch also adds some code
234 around the stub so that class PHP_Archive gets regis‐
235 tered as phar:// stream wrapper if necessary. And
236 finally this switch will add the file phar.inc from this
237 package and load it to ensure class Phar is present.
238
239 -s stub Select the stub file.
240
241 -x regex Regular expression for input files to exclude.
242
243 -y key Private key for OpenSSL signing.
244
245
247 Set signature hash algorithm.
248
249 Required arguments:
250
251 -f file Specifies the phar file to work on.
252
253 -h hash Selects the hash algorithm (see HASH )
254
255 Optional arguments:
256
257 -y key Private key for OpenSSL signing.
258
259
261 Get the stub of a PHAR file. If no output file is specified as stub
262 then stdout is being used.
263
264 Required arguments:
265
266 -f file Specifies the phar file to work on.
267
268 Optional arguments:
269
270 -s stub Select the stub file.
271
272
274 Set the stub of a PHAR file. If no input file is specified as stub then
275 stdin is being used.
276
277 Required arguments:
278
279 -f file Specifies the phar file to work on.
280
281 Optional arguments:
282
283 -b bang Hash-bang line to start the archive (e.g.
284 #!/usr/bin/php). The hash mark itself '#!' and the new‐
285 line character are optional.
286
287 -p loader Location of PHP_Archive class file (pear list-files
288 PHP_Archive).You can use '0' or '1' to locate it auto‐
289 matically using the mentioned pear command. When using
290 '0' the command does not error out when the class file
291 cannot be located. This switch also adds some code
292 around the stub so that class PHP_Archive gets regis‐
293 tered as phar:// stream wrapper if necessary. And
294 finally this switch will add the file phar.inc from this
295 package and load it to ensure class Phar is present.
296
297 -s stub Select the stub file.
298
299
300
302 Get a directory tree for a PHAR archive.
303
304 Required arguments:
305
306 -f file Specifies the phar file to work on.
307
308 Optional arguments:
309
310 -i regex Specifies a regular expression for input files.
311
312 -x regex Regular expression for input files to exclude.
313
314
316 Get information about the PHAR environment and the tool version.
317
318
319
321 Algorithms:
322
323 0 No compression
324
325 none No compression
326
327 auto Automatically select compression algorithm
328
329 gz GZip compression
330
331 gzip GZip compression
332
333 bz2 BZip2 compression
334
335 bzip2 BZip2 compression
336
337
339 Algorithms:
340
341
342 md5 MD5
343
344 sha1 SHA1
345
346 sha256 SHA256
347
348 sha512 SHA512
349
350 openssl OpenSSL
351
352
354 For a more or less complete description of PHAR look here:
355 http://php.net/phar
356
358 You can view the list of known bugs or report any new bug you
359 found at:
360 http://bugs.php.net
361
363 The PHP Group: Thies C. Arntzen, Stig Bakken, Andi Gutmans, Ras‐
364 mus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Win‐
365 stead, Andrei Zmievski.
366
367 Work for the PHP archive was done by Gregory Beaver, Marcus
368 Boerger.
369
370 A List of active developers can be found here:
371 http://www.php.net/credits.php
372
373 And last but not least PHP was developed with the help of a huge
374 amount of contributors all around the world.
375
377 This manpage describes phar, version 7.3.6.
378
380 Copyright © 1997-2018 The PHP Group
381
382 This source file is subject to version 3.01 of the PHP license,
383 that is bundled with this package in the file LICENSE, and is
384 available through the world-wide-web at the following url:
385 http://www.php.net/license/3_01.txt
386
387 If you did not receive a copy of the PHP license and are unable
388 to obtain it through the world-wide-web, please send a note to
389 license@php.net so we can mail you a copy immediately.
390
391
392
393The PHP Group 2018 PHAR(1)