当前位置: 首页>>代码示例>>PHP>>正文


PHP Phar::loadPhar方法代码示例

本文整理汇总了PHP中Phar::loadPhar方法的典型用法代码示例。如果您正苦于以下问题:PHP Phar::loadPhar方法的具体用法?PHP Phar::loadPhar怎么用?PHP Phar::loadPhar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phar的用法示例。


在下文中一共展示了Phar::loadPhar方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($binDir, $jsonDir)
 {
     \Phar::loadPhar($binDir . '/composer.phar', 'composer.phar');
     require 'phar://composer.phar/src/bootstrap.php';
     $this->io = new \Composer\IO\NullIO();
     $this->composer = \Composer\Factory::create($this->io, $jsonDir . '/composer.json');
     $vendorDir = $this->composer->getConfig()->get('vendor-dir');
     $jsonFile = new \Composer\Json\JsonFile($vendorDir . '/composer/installed.json');
     $this->composer->getRepositoryManager()->setLocalRepository(new \Composer\Repository\InstalledFilesystemRepository($jsonFile));
 }
开发者ID:Xinc-org,项目名称:Xinc.Packager,代码行数:10,代码来源:Outside.php

示例2: checkComposer

 /**
  * Check for composer in Namespace
  * and include via phar if possible
  */
 public static function checkComposer($pathToComposer = null)
 {
     if (!class_exists('Composer\\Factory')) {
         if (false === ($pathToComposer = self::whichComposer($pathToComposer))) {
             throw new \RuntimeException("Could not find composer.phar");
         }
         \Phar::loadPhar($pathToComposer, 'composer.phar');
         include "phar://composer.phar/vendor/autoload.php";
     }
 }
开发者ID:RettuSh,项目名称:e-szen,代码行数:14,代码来源:ComposerAdapter.php

示例3: checkComposer

 /**
  * Check for composer in Namespace
  * and include via phar if possible
  */
 public static function checkComposer($pathToComposer = null)
 {
     if (!class_exists("Composer\\Factory")) {
         if (false === ($pathToComposer = self::whichComposer($pathToComposer))) {
             throw new \RuntimeException("Could not find composer.phar");
         }
         \Phar::loadPhar($pathToComposer, 'composer.phar');
         $loader = new UniversalClassLoader();
         $namespaces = (include "phar://composer.phar/vendor/composer/autoload_namespaces.php");
         $loader->registerNamespaces(array_merge(array('Composer' => "phar://composer.phar/src/"), $namespaces));
         $loader->register(true);
     }
 }
开发者ID:Viduc,项目名称:tiremoidlaold,代码行数:17,代码来源:ComposerAdapter.php

示例4: testExecuteRegExp

 public function testExecuteRegExp()
 {
     $this->checkReadonly();
     $plugin = $this->getPlugin(array('regexp' => '/\\.(php|phtml)$/'));
     $path = $this->buildSource();
     $plugin->getPHPCI()->buildPath = $path;
     $this->assertTrue($plugin->execute());
     $this->assertFileExists($path . '/build.phar');
     PHPPhar::loadPhar($path . '/build.phar');
     $this->assertFileEquals($path . '/one.php', 'phar://build.phar/one.php');
     $this->assertFileEquals($path . '/two.php', 'phar://build.phar/two.php');
     $this->assertFileNotExists('phar://build.phar/config/config.ini');
     $this->assertFileEquals($path . '/views/index.phtml', 'phar://build.phar/views/index.phtml');
 }
开发者ID:ntoniazzi,项目名称:PHPCI,代码行数:14,代码来源:PharTest.php

示例5: define

 *
 * @copyright  Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE
 */
// Set the Joomla execution flag.
define('_JEXEC', 1);
// Allow the application to run as long as is necessary.
ini_set('max_execution_time', 0);
// Note, you would not use these settings in production.
error_reporting(E_ALL);
ini_set('display_errors', true);
// Ensure that required path constants are defined.
if (!defined('JPATH_BASE')) {
    define('JPATH_BASE', realpath(__DIR__));
}
Phar::loadPhar(realpath(JPATH_BASE . '/../libraries/joomla.phar'));
// Define the path for the Joomla Platform.
if (!defined('JPATH_PLATFORM')) {
    $platform = getenv('JPLATFORM_HOME');
    if ($platform) {
        define('JPATH_PLATFORM', realpath($platform));
    } else {
        // Platform directory instead of phar: define('JPATH_PLATFORM', JPATH_BASE . '/../../joomla-platform/libraries');
        define('JPATH_PLATFORM', 'phar://joomla.phar/libraries');
    }
}
// Ensure that required path constants are defined.
if (!defined('JPATH_CONFIGURATION')) {
    $path = getenv('WEBSERVICE_CONFIG');
    if ($path) {
        define('JPATH_CONFIGURATION', realpath($path));
开发者ID:prox91,项目名称:joomla-dev,代码行数:31,代码来源:bootstrap.php

示例6:

<?php

Phar::loadPhar(__DIR__ . '/phar1.phar');
require_once 'phar://p.phar/includes1/file.php';
开发者ID:gqtan,项目名称:maven-php-plugin,代码行数:4,代码来源:alias.php

示例7: dirname

<?php

$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://' . $fname;
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();
$files['a.php'] = '<?php echo "This is a\\n"; include \'' . $pname . '/b.php\'; ?>';
$files['b.php'] = '<?php echo "This is b\\n"; include \'' . $pname . '/b/c.php\'; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\\n"; include \'' . $pname . '/b/d.php\'; ?>';
$files['b/d.php'] = '<?php echo "This is b/d\\n"; include \'' . $pname . '/e.php\'; ?>';
$files['e.php'] = '<?php echo "This is e\\n"; ?>';
$files['.phar/test'] = '<?php bad boy ?>';
include 'files/phar_test.inc';
Phar::loadPhar($fname);
require $pname . '/a.php';
$p = new Phar($fname);
var_dump(isset($p['.phar/test']));
try {
    $p['.phar/test'];
} catch (Exception $e) {
    echo $e->getMessage(), "\n";
}
?>
===DONE===
开发者ID:gleamingthecube,项目名称:php,代码行数:24,代码来源:ext_phar_tests_030.php

示例8: dirname

<?php

$fname1 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.1.phar.php';
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.php';
$fname = $fname1;
$alias = '';
$pname = 'phar://hio';
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$files = array();
$files['a.php'] = '<?php echo "This is a\\n"; include "' . $pname . '/b.php"; ?>';
$files['b.php'] = '<?php echo "This is b\\n"; include "' . $pname . '/b/c.php"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\\n"; include "' . $pname . '/b/d.php"; ?>';
$files['b/d.php'] = '<?php echo "This is b/d\\n"; include "' . $pname . '/e.php"; ?>';
$files['e.php'] = '<?php echo "This is e\\n"; ?>';
include 'files/phar_test.inc';
copy($fname1, $fname2);
var_dump(Phar::loadPhar($fname1, 'hio'));
var_dump(Phar::loadPhar($fname1, 'copy'));
$a = new Phar($fname1);
try {
    var_dump(Phar::loadPhar($fname2, 'copy'));
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
}
?>
===DONE===
开发者ID:zaky-92,项目名称:php-1,代码行数:26,代码来源:ext_phar_tests_029.php

示例9: ini_set

<?php

ini_set('phar.readonly', 1);
function print_exception($e)
{
    echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n";
}
Phar::mungServer('hi');
Phar::createDefaultStub(array());
Phar::loadPhar(array());
Phar::canCompress('hi');
try {
    $a = new Phar(array());
} catch (TypeError $e) {
    print_exception($e);
}
try {
    $a = new Phar(dirname(__FILE__) . '/files/frontcontroller10.phar');
} catch (PharException $e) {
    print_exception($e);
}
$a->convertToExecutable(array());
$a->convertToData(array());
try {
    $b = new PharData(dirname(__FILE__) . '/whatever.tar');
} catch (PharException $e) {
    print_exception($e);
}
try {
    $c = new PharData(dirname(__FILE__) . '/whatever.zip');
} catch (PharException $e) {
开发者ID:zaky-92,项目名称:php-1,代码行数:31,代码来源:ext_phar_tests_badparameters.php

示例10: dirname

<?php

$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
$pname = 'phar://hio';
$file = '<?php include "' . $pname . '/a.php"; __HALT_COMPILER(); ?>';
$alias = '';
$files = array();
$files['a.php'] = '<?php echo "This is a\\n"; include "' . $pname . '/b.php"; ?>';
$files['b.php'] = '<?php echo "This is b\\n"; include "' . $pname . '/b/c.php"; ?>';
$files['b/c.php'] = '<?php echo "This is b/c\\n"; include "' . $pname . '/b/d.php"; ?>';
$files['b/d.php'] = '<?php echo "This is b/d\\n"; include "' . $pname . '/e.php"; ?>';
$files['e.php'] = '<?php echo "This is e\\n"; ?>';
include 'files/phar_test.inc';
Phar::loadPhar($fname, 'hio');
include $fname;
echo "======\n";
include $pname . '/a.php';
?>
===DONE===
<?php 
error_reporting(0);
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php');
开发者ID:badlamer,项目名称:hhvm,代码行数:22,代码来源:028.php

示例11: copy

}
/**
 * Install composer
 */
if (!is_file('composer.phar')) {
    copy('http://getcomposer.org/composer.phar', 'composer.phar');
    if (!is_file('composer.phar')) {
        $error = error_get_last();
        echo json_encode(['message' => 'Downloading dependencies, this may take several minutes...', 'done' => false, 'error' => $error['message']]);
    } else {
        echo json_encode(['message' => 'Downloading dependencies, this may take several minutes...', 'done' => true, 'error' => false]);
    }
    exit;
}
if (!is_file('Vendor/autoload.php')) {
    \Phar::loadPhar('composer.phar', 'composer.phar');
    require 'phar://composer.phar/src/bootstrap.php';
    $input = new Symfony\Component\Console\Input\ArrayInput(array('command' => 'install'));
    $application = new Composer\Console\Application();
    $output = new \Symfony\Component\Console\Output\BufferedOutput();
    $application->setAutoExit(false);
    $result = $application->run($input, $output);
    echo json_encode(['message' => 'Done. Reloading installation...', 'done' => false, 'error' => $result !== 0 ? nl2br($output->fetch()) : false]);
    exit;
}
require 'Vendor/autoload.php';
define('CACHE_DI_PATH', 'Cache/DI');
define('CACHE_DOCTRINE_PROXY_PATH', 'Cache/DoctrineProxies');
define('CACHE_DOCTRINE_MODULE_FILE', 'Cache/doctrine_module_dir.cache');
define('JS_FOLDER', '/js');
define('CSS_FOLDER', '/css');
开发者ID:fraym,项目名称:fraym,代码行数:31,代码来源:install.php

示例12: loadComposer

 /**
  * Inlcude composer
  */
 public function loadComposer()
 {
     putenv("COMPOSER_HOME=.composer");
     ini_set('memory_limit', '-1');
     if (!class_exists(\Composer\Console\Application::class)) {
         \Phar::loadPhar('composer.phar', 'composer.phar');
         require_once 'phar://composer.phar/src/bootstrap.php';
     }
 }
开发者ID:fraym,项目名称:core,代码行数:12,代码来源:RegistryManager.php


注:本文中的Phar::loadPhar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。