Skip to content

Instantly share code, notes, and snippets.

@jakzal
Created September 4, 2012 21:09
Show Gist options
  • Save jakzal/3626526 to your computer and use it in GitHub Desktop.
Save jakzal/3626526 to your computer and use it in GitHub Desktop.
Compile Symfony's check.php into a phar
<?php
$phar = new \Phar('symfony-check.phar', 0, 'symfony-check.phar');
$phar->startBuffering();
$files = array(
'app/check.php',
'app/SymfonyRequirements.php',
'vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'
);
foreach ($files as $file) {
$phar->addFromString($file, file_get_contents($file));
}
$stub = <<<'EOF'
#!/usr/bin/env php
<?php
Phar::mapPhar('symfony-check.phar');
require 'phar://symfony-check.phar/app/check.php';
__HALT_COMPILER();
EOF;
$phar->setStub($stub);
$phar->stopBuffering();
unset($phar);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment