Created
February 3, 2014 20:51
-
-
Save spekkionu/8792129 to your computer and use it in GitHub Desktop.
Builds monolog as phar
This file contains 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 monolog phar\n"; | |
$phar = new Phar($buildRoot.'/monolog.phar', 0, 'monolog.phar'); | |
$phar->buildFromIterator($iterator, $srcRoot); | |
$phar->setStub($phar->createDefaultStub("autoload.php")); | |
exit("Build complete\n"); |
This file contains 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": { | |
"monolog/monolog": "@stable" | |
}, | |
"config": { | |
"preferred-install": "dist" | |
}, | |
"prefer-stable": true, | |
"minimum-stability": "dev", | |
"scripts": { | |
"post-update-cmd": "php build.php", | |
"post-install-cmd": "php build.php" | |
} | |
} |
This file contains 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 Monolog\Logger; | |
use Monolog\Handler\StreamHandler; | |
require_once(__DIR__.'/monolog.phar'); | |
// create a log channel | |
$log = new Logger('name'); | |
$log->pushHandler(new StreamHandler(STDOUT)); | |
// add records to the log | |
$log->addWarning('Foo'); | |
$log->addError('Bar'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment