Skip to content

Commit

Permalink
fixed phar autoloader
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelog committed Feb 9, 2012
1 parent f6f18dc commit f0da859
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions resources/generatePhar.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
$stub = $stub =
'<?php '<?php
Phar::mapPhar(); Phar::mapPhar();
spl_autoload_register(function ($class) {
$classFile = "phar://pami.phar/" . str_replace("\\\", "/", $class) . ".php";
if (file_exists($classFile)) {
require_once $classFile;
return true;
}
});
include "phar://pami.phar/PAMI/Autoloader/Autoloader.php"; include "phar://pami.phar/PAMI/Autoloader/Autoloader.php";
\PAMI\Autoloader\Autoloader::register(); \PAMI\Autoloader\Autoloader::register();
__HALT_COMPILER(); __HALT_COMPILER();
Expand All @@ -10,3 +17,4 @@
$phar->setAlias('pami.phar'); $phar->setAlias('pami.phar');
$phar->buildFromDirectory($argv[2]); $phar->buildFromDirectory($argv[2]);
$phar->setStub($stub); $phar->setStub($stub);

0 comments on commit f0da859

Please sign in to comment.