createPhar.php 522 B

1234567891011121314151617181920212223
  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. $phar->buildFromDirectory(__DIR__, '/\.sql/');
  12. $defaultStub = $phar->createDefaultStub('chash.php');
  13. // Create a custom stub to add the shebang
  14. $stub = "#!/usr/bin/env php \n".$defaultStub;
  15. // Add the stub
  16. $phar->setStub($stub);
  17. $phar->stopBuffering();