createPhar.php 473 B

123456789101112131415161718192021
  1. <?php
  2. /**
  3. * Make sure you have this setting in your php.ini (cli)
  4. * phar.readonly = Off
  5. */
  6. error_reporting(-1);
  7. $phar = new Phar('chash.phar');
  8. $phar->setSignatureAlgorithm(\Phar::SHA1);
  9. $phar->startBuffering();
  10. $phar->buildFromDirectory(__DIR__, '/\.php$/');
  11. $defaultStub = $phar->createDefaultStub('chash.php');
  12. // Create a custom stub to add the shebang
  13. $stub = "#!/usr/bin/env php \n".$defaultStub;
  14. // Add the stub
  15. $phar->setStub($stub);
  16. $phar->stopBuffering();