Advertisement
lignite0

make-phar.php

May 14th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1. <?php
  2.  
  3. // #!/usr/bin/env php
  4. // php --define phar.readonly=0 ./make-phar.php $1
  5.  
  6. if ($argc === 1) {
  7.     echo "Usage: {$argv[0]} <phar-name>";
  8.     exit;
  9. }
  10.  
  11. $pharFilename = basename($argv[1]);
  12. $pharFilePath = "build/{$pharFilename}.phar";
  13.  
  14. if (file_exists($pharFilePath)) {
  15.     unlink($pharFilePath);
  16. }
  17.  
  18. $phar = new Phar($pharFilePath);
  19. $phar->startBuffering();
  20. $phar->buildFromDirectory('./');
  21. $phar->setDefaultStub('src/index.php');
  22. $phar->stopBuffering();
  23.  
  24. echo "{$pharFilePath} successfully created";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement