See Release Notes
Long Term Support Release
1 <?php 2 3 # required: PHP 5.3+ and zlib extension 4 5 // ini option check 6 if (ini_get('phar.readonly')) { 7 echo "php.ini: set the 'phar.readonly' option to 0 to enable phar creation\n"; 8 exit(1); 9 } 10 11 // output name 12 $pharName = 'Matrix.phar'; 13 14 // target folder 15 $sourceDir = __DIR__ . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR; 16 17 // default meta information 18 $metaData = array( 19 'Author' => 'Mark Baker <mark@lange.demon.co.uk>', 20 'Description' => 'PHP Class for working with Matrix numbers', 21 'Copyright' => 'Mark Baker (c) 2013-' . date('Y'), 22 'Timestamp' => time(), 23 'Version' => '0.1.0', 24 'Date' => date('Y-m-d') 25 ); 26 27 // cleanup 28 if (file_exists($pharName)) { 29 echo "Removed: {$pharName}\n"; 30 unlink($pharName); 31 } 32 33 echo "Building phar file...\n"; 34 35 // the phar object 36 $phar = new Phar($pharName, null, 'Matrix'); 37 $phar->buildFromDirectory($sourceDir); 38 $phar->setStub( 39 <<<'EOT' 40 <?php 41 spl_autoload_register(function ($className) { 42 include 'phar://' . $className . '.php'; 43 }); 44 45 try { 46 Phar::mapPhar(); 47 } catch (PharException $e) { 48 error_log($e->getMessage()); 49 exit(1); 50 } 51 52 include 'phar://functions/sqrt.php'; 53 54 __HALT_COMPILER(); 55 EOT 56 ); 57 $phar->setMetadata($metaData); 58 $phar->compressFiles(Phar::GZ); 59 60 echo "Complete.\n"; 61 62 exit();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body