Created
February 3, 2014 20:54
-
-
Save spekkionu/8792174 to your computer and use it in GitHub Desktop.
Build Slim framework 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
<?php | |
require('Slim/Slim.php'); | |
\Slim\Slim::registerAutoloader(); |
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 | |
$srcRoot = realpath(__DIR__."/vendor/slim/slim"); | |
$buildRoot = realpath(__DIR__); | |
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($srcRoot.DIRECTORY_SEPARATOR.'Slim', FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::LEAVES_ONLY); | |
echo "Build Slim phar\n"; | |
$phar = new Phar($buildRoot.'/slim.phar', 0, 'slim.phar'); | |
$phar->buildFromIterator($iterator, $srcRoot); | |
$phar->addFile(__DIR__.DIRECTORY_SEPARATOR.'autoload.php', 'autoload.php'); | |
$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": { | |
"slim/slim": "@stable" | |
}, | |
"config": { | |
"preferred-install": "dist" | |
}, | |
"prefer-stable": true, | |
"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 | |
require(__DIR__.'/slim.phar'); | |
$app = new \Slim\Slim(); | |
var_dump($app); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment