1<?php
2
3/**
4 * This creates a standalone phar file with all of the PHP source included. To run the
5 * phar just type 'php generate-phpt.phar <options>' at the command line.
6 */
7
8if (Phar::canWrite()) {
9  echo "Writing phar archive\n";
10} else {
11  echo "Unable to write archive, check that phar.readonly is 0 in your php.ini\n";
12  exit();
13}
14$thisDir = dirname(__FILE__);
15$pharPath = substr($thisDir, 0, -strlen('/generate-phpt'));
16
17$phar = new Phar($pharPath.'/generate-phpt.phar');
18
19$phar->buildFromDirectory($thisDir.'/src');
20
21$stub = <<<ENDSTUB
22<?php
23Phar::mapPhar('generate-phpt.phar');
24require 'phar://generate-phpt.phar/generate-phpt.php';
25__HALT_COMPILER();
26ENDSTUB;
27
28$phar->setStub($stub);
29
30?>
31