#!/usr/bin/env php startBuffering(); $base_dir = realpath(__DIR__.'/../'); $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(realpath(__DIR__.'/../src'), RecursiveDirectoryIterator::SKIP_DOTS)); foreach ($it as $entry) { $phar->addFile($entry->getPathName(), str_replace($base_dir, '', $entry->getPathName())); } $vendor = [ 'composer', 'psr', 'symfony' ]; foreach ($vendor as $dir) { $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(realpath(__DIR__.'/../vendor/'.$dir), RecursiveDirectoryIterator::SKIP_DOTS)); foreach ($it as $entry) { $phar->addFile($entry->getPathName(), str_replace($base_dir, '', $entry->getPathName())); } } $phar->addFile(realpath(__DIR__.'/../vendor/autoload.php'), 'vendor/autoload.php'); $phar->addFile(realpath(__DIR__.'/../composer.json'), 'composer.json'); $phar->addFile(realpath(__DIR__.'/../LICENSE.md'), 'LICENSE.md'); $phar->addFile(realpath(__DIR__.'/../README.md'), 'README.md'); $bin_file = file_get_contents(__DIR__.'/logchecker'); $bin_file = preg_replace('{^#!/usr/bin/env php\s*}', '', $bin_file); $phar->addFromString('bin/logchecker', $bin_file); $stub = <<setStub($stub); $phar->stopBuffering(); //$phar->compress(Phar::GZ); echo "{$phar_file} generated...";