Created
February 3, 2014 20:49
-
-
Save spekkionu/8792084 to your computer and use it in GitHub Desktop.
Build Symfony console component as phar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php -dphar.readonly=0 | |
<?php | |
$srcRoot = realpath(__DIR__."/vendor"); | |
$buildRoot = realpath(__DIR__); | |
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($srcRoot, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::LEAVES_ONLY); | |
/* | |
foreach($iterator as $file){ | |
var_dump($file->getFilename()); | |
} | |
*/ | |
echo "Build Symfony Console phar\n"; | |
$phar = new Phar($buildRoot.'/console.phar', 0, 'console.phar'); | |
$phar->buildFromIterator($iterator, $srcRoot); | |
$phar->setStub($phar->createDefaultStub("autoload.php")); | |
exit("Build complete\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"symfony/console": "@stable", | |
"symfony/filesystem": "@stable", | |
"symfony/finder": "@stable", | |
"symfony/process": "@stable" | |
}, | |
"minimum-stability": "dev", | |
"config": { | |
"preferred-install": "dist" | |
}, | |
"prefer-stable": true, | |
"scripts": { | |
"post-update-cmd": "php build.php", | |
"post-install-cmd": "php build.php" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\Console\Output\ConsoleOutput as Output; | |
require_once(__DIR__.'/console.phar'); | |
$console = new Output(); | |
$console->writeln("<info>Green Text</info>"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment