#!/usr/bin/env php setSignatureAlgorithm(\Phar::SHA1); $phar->startBuffering(); $finder = new Symfony\Component\Finder\Finder(); $finder->files() ->ignoreVCS(true) ->name('*.php') ->name('*.json') ->name('*.exe') ->exclude('phpunit') ->exclude('Tests') ->exclude('test') ->exclude('tests') ->exclude('phpspec') ->in(__DIR__); foreach ($finder as $fileInfo) { $file = str_replace(__DIR__, '', $fileInfo->getRealPath()); echo "Add file: " . $file . "\n"; $phar->addFile($fileInfo->getRealPath(), $file); } // Add bin/dep file $depContent = file_get_contents(__DIR__ . '/bin/dep'); $depContent = str_replace("#!/usr/bin/env php\n", '', $depContent); $depContent = str_replace("'master'", "'$version'", $depContent); $depContent = str_replace('__FILE__', 'str_replace("phar://", "", Phar::running())', $depContent); $phar->addFromString('bin/dep', $depContent); $stub = <<setStub($stub); // Bug #53467. Phar cannot compress large archives. https://bugs.php.net/bug.php?id=53467 // $phar->compressFiles(Phar::GZ); $phar->stopBuffering(); unset($phar); echo "$pharName was created successfully.\n";