Skip to content

Instantly share code, notes, and snippets.

@spekkionu
Created February 3, 2014 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spekkionu/8792386 to your computer and use it in GitHub Desktop.
Save spekkionu/8792386 to your computer and use it in GitHub Desktop.
Build Zend Framework 1.x as phar
<?php
require('Zend'.DIRECTORY_SEPARATOR.'Loader'.DIRECTORY_SEPARATOR.'AutoloaderFactory.php');
Zend_Loader_AutoloaderFactory::factory(array(
'Zend_Loader_StandardAutoloader' => array(
'prefixes' => array(
'Zend' => 'Zend'
)
)
));
#!/usr/bin/php -dphar.readonly=0
<?php
$srcRoot = realpath(__DIR__."/vendor/digital-canvas/zend-framework/library");
$buildRoot = __DIR__;
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($srcRoot.'/Zend', FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::LEAVES_ONLY);
echo "Build Zend Framework phar\n";
$phar = new Phar($buildRoot.'/zend-framework.phar', 0, 'zend-framework.phar');
$phar->buildFromIterator($iterator, $srcRoot);
$phar->addFile(__DIR__.DIRECTORY_SEPARATOR.'autoload.php', 'autoload.php');
$phar->setStub($phar->createDefaultStub("autoload.php"));
exit("Build complete\n");
{
"require": {
"digital-canvas/zend-framework": "@stable"
},
"config": {
"preferred-install": "dist"
},
"prefer-stable": true,
"scripts": {
"post-update-cmd": "php build.php",
"post-install-cmd": "php build.php"
}
}
<?php
require_once(__DIR__.'/zend-framework.phar');
Zend_Debug::dump("zf1");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment