• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Phar类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testOpenSSLSignature

 public function testOpenSSLSignature()
 {
     if (!extension_loaded('OpenSSL')) {
         $this->markTestSkipped("Need OpenSSL extension");
     }
     // Generate a private key on the fly.
     $passphrase = uniqid();
     $passfile = PHING_TEST_BASE . '/etc/tasks/ext/pharpackage/pass.txt';
     file_put_contents($passfile, $passphrase);
     $pkey = openssl_pkey_new();
     openssl_pkey_export_to_file($pkey, PHING_TEST_BASE . '/etc/tasks/ext/pharpackage/priv.key', $passphrase);
     $this->executeTarget(__FUNCTION__);
     // Make sure we are dealing with an OpenSSL signature.
     // (Phar silently falls back to an SHA1 signature
     // whenever it fails to add an OpenSSL signature)
     $dest = PHING_TEST_BASE . '/etc/tasks/ext/pharpackage/pharpackage.phar';
     $this->assertFileExists($dest);
     $phar = new Phar($dest);
     $signature = $phar->getSignature();
     $this->assertEquals('OpenSSL', $signature['hash_type']);
     unlink(PHING_TEST_BASE . '/etc/tasks/ext/pharpackage/priv.key');
     unlink(PHING_TEST_BASE . '/etc/tasks/ext/pharpackage/pharpackage.phar.pubkey');
     unlink(PHING_TEST_BASE . '/etc/tasks/ext/pharpackage/pass.txt');
     unlink($dest);
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:25,代码来源:PharPackageTaskTest.php


示例2: addFile

 /**
  * @param \Phar $phar
  * @param SplFileInfo $file
  */
 private function addFile(\Phar $phar, SplFileInfo $file)
 {
     $path = $file->getRelativePathname();
     $content = file_get_contents($file);
     $content = preg_replace('{^#!/usr/bin/env php\\s*}', '', $content);
     $phar->addFromString($path, $content);
 }
开发者ID:webcreate,项目名称:conveyor,代码行数:11,代码来源:PharTask.php


示例3: compile

 public function compile($pharFile = 'already-extract.phar')
 {
     if (file_exists($pharFile)) {
         unlink($pharFile);
     }
     $phar = new \Phar($pharFile, 0, 'already-extract.phar');
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->notName('Compiler.php')->in(__DIR__ . '/..');
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->exclude('Tests')->in(__DIR__ . '/../../vendor/symfony/');
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/autoload.php'));
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/autoload_namespaces.php'));
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/autoload_psr4.php'));
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/autoload_classmap.php'));
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/autoload_real.php'));
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/ClassLoader.php'));
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/include_paths.php'));
     $this->addAlreadyExtractBin($phar);
     $phar->setStub($this->getStub());
     $phar->stopBuffering();
     unset($phar);
 }
开发者ID:mhor,项目名称:already-extract,代码行数:30,代码来源:Compiler.php


示例4: compile

 /**
  * Compiles the Hydra source code into one single Phar file.
  *
  * @param string $pharFile Name of the output Phar file
  */
 public function compile($pharFile = 'hydra.phar')
 {
     if (file_exists($pharFile)) {
         unlink($pharFile);
     }
     $phar = new \Phar($pharFile, 0, 'hydra.phar');
     $phar->startBuffering();
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->name('*.twig')->notName('PharCompiler.php')->exclude('Tests')->in('src')->in('views')->in('../../twig/twig/lib')->in('../../monolog/monolog/src')->in('../../symfony/http-kernel/Symfony/Component/HttpKernel/Exception')->in('../../symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType')->in('../../symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception');
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     $this->addFile($phar, new \SplFileInfo('../../symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php'));
     $this->addFile($phar, new \SplFileInfo('../../symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php'));
     $this->addFile($phar, new \SplFileInfo('../../symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php'));
     $this->addFile($phar, new \SplFileInfo('../../symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php'));
     $this->addFile($phar, new \SplFileInfo('../../symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php'));
     $this->addFile($phar, new \SplFileInfo('../../autoload.php'));
     $this->addFile($phar, new \SplFileInfo('../../composer/ClassLoader.php'));
     $this->addFile($phar, new \SplFileInfo('../../composer/autoload_namespaces.php'));
     $this->addFile($phar, new \SplFileInfo('../../composer/autoload_classmap.php'));
     $phar->setStub($this->getStub());
     $phar->stopBuffering();
     //        $phar->compressFiles(\Phar::GZ);
 }
开发者ID:z7,项目名称:hydra,代码行数:30,代码来源:PharCompiler.php


示例5: _build

 protected static function _build($conf)
 {
     $pathToPhar = $conf['path_to_phar'];
     $pharName = $conf['phar_name'];
     $srcPath = $conf['src_path'];
     $initModule = $conf['init_module'];
     $setup = $conf['setup'];
     $file = $pathToPhar . '/' . $pharName;
     if ($conf['delete_old_phar_onbuild'] && \file_exists($file)) {
         \unlink($file);
     }
     $falias = $pharName;
     $mapPhar = $pharName;
     $phar = new \Phar($file, 0, $falias);
     $phar->startBuffering();
     $dir = $phar->buildFromDirectory($srcPath);
     $stub = '<?php ' . "\\Phar::mapPhar('{$falias}'); " . 'include ' . "'phar://{$falias}/{$initModule}'; " . "{$setup}" . '__HALT_COMPILER();';
     $phar->setStub($stub);
     //
     //
     if (isset($conf['compress_pkg']) && $conf['compress_pkg'] == 'GZ') {
         $phar->compressFiles(\Phar::GZ);
     }
     //
     //
     $phar->stopBuffering();
 }
开发者ID:swwwfactory,项目名称:entry8,代码行数:27,代码来源:utils.php


示例6: addFile

 private function addFile(\Phar $phar, \SplFileInfo $file)
 {
     $path = str_replace(dirname(dirname(dirname(__DIR__))) . DIRECTORY_SEPARATOR, '', $file->getRealPath());
     $content = file_get_contents($file);
     $content = $this->stripWhitespace($content);
     $phar->addFromString($path, $content);
 }
开发者ID:bcncommerce,项目名称:magebuild,代码行数:7,代码来源:Compiler.php


示例7: compile

 /**
  * Compiles composer into a single phar file
  *
  * @throws \RuntimeException
  */
 public function compile()
 {
     $pharFile = 'refactor.phar';
     if (file_exists($pharFile)) {
         unlink($pharFile);
     }
     $process = new Process('git log --pretty="%H" -n1 HEAD', $this->directory);
     if ($process->run() != 0) {
         throw new \RuntimeException('Can\'t run git log. You must ensure to run compile from git repository clone and that git binary is available.');
     }
     $this->version = trim($process->getOutput());
     $process = new Process('git describe --tags HEAD');
     if ($process->run() == 0) {
         $this->version = trim($process->getOutput());
     }
     $phar = new \Phar($pharFile, 0, 'refactor.phar');
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->notName('Compiler.php')->in($this->directory . '/src/main');
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->exclude('test')->exclude('features')->in($this->directory . '/vendor/');
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     $this->addRefactorBin($phar);
     // Stubs
     $phar->setStub($this->getStub());
     $phar->stopBuffering();
     unset($phar);
 }
开发者ID:roozbehmatloobi,项目名称:php-refactoring-browser,代码行数:39,代码来源:Compiler.php


示例8: doExecute

    /**
     * Method to run the application routines.  Most likely you will want to instantiate a controller
     * and execute it, or perform some sort of task directly.
     *
     * @return  void
     *
     * @since   2.0
     */
    protected function doExecute()
    {
        if ($this->io->getOption('h') || $this->io->getOption('help')) {
            $this->help();
            return;
        }
        $dir = $this->io->getOption('d', '../../vaseman.phar');
        $file = __DIR__ . '/' . $dir;
        if (is_file($file)) {
            unlink($file);
        }
        $this->out('Start generating...');
        $phar = new Phar($file);
        $phar->setStub(<<<PHP
#!/usr/bin/env php
<?php

Phar::mapPhar('vaseman.phar');

require 'phar://vaseman.phar/bin/vaseman'; __HALT_COMPILER();
PHP
);
        $phar->buildFromDirectory(__DIR__ . '/..');
        $phar->stopBuffering();
        $this->out('Phar generated: ' . $file)->out();
    }
开发者ID:bgao-ca,项目名称:vaseman,代码行数:34,代码来源:build.php


示例9: compile

 public function compile($pharFile = self::PHAR_FILE, $root_dir = null)
 {
     if (is_null($root_dir)) {
         $this->root_dir = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR;
     } else {
         $this->root_dir = rtrim($root_dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
     }
     if (file_exists($pharFile)) {
         unlink($pharFile);
     }
     $phar = new \Phar($pharFile, 0, self::PHAR_NAME);
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     $finder = $this->getDefaultFinder();
     $finder->name('*.php');
     foreach ($finder as $file) {
         $this->__addFile($phar, $file);
     }
     $finder = $this->getDefaultFinder();
     $finder->name('*.json')->name('*.ini')->name('*.man')->name('*.md')->name('*.tpl')->name('LICENSE');
     foreach ($finder as $file) {
         $this->__addFile($phar, $file, false);
     }
     // global binary
     $this->__addBin($phar);
     // add the __stub
     $phar->setStub($this->__getStub());
     $phar->stopBuffering();
     unset($phar);
     return $this->_logs;
 }
开发者ID:atelierspierrot,项目名称:markdown-extended,代码行数:31,代码来源:Compiler.php


示例10: compile

 /**
  * Compiles satis into a single phar file
  *
  * @param  string $pharFile The full path to the file to create
  *
  * @throws \RuntimeException
  */
 public function compile($pharFile = 'satis.phar')
 {
     if (file_exists($pharFile)) {
         unlink($pharFile);
     }
     $phar = new \Phar($pharFile, 0, 'satis.phar');
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     $finders = array();
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->notName('Compiler.php')->in(__DIR__ . '/../../');
     $finders[] = $finder;
     $finder = new Finder();
     $finder->files()->name('*')->in(__DIR__ . '/../../../views/');
     $finders[] = $finder;
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->name('composer-schema.json')->exclude(array('phpunit', 'mikey179', 'phpdocumentor', 'sebastian', 'phpspec', 'doctrine', 'test', 'tests', 'Tests'))->in(__DIR__ . '/../../../vendor/');
     $finders[] = $finder;
     foreach ($finders as $finder) {
         foreach ($finder as $file) {
             $this->addFile($phar, $file);
         }
     }
     $this->addSatisBin($phar);
     // Stubs
     $phar->setStub($this->getStub());
     $phar->stopBuffering();
     $phar->compressFiles(\Phar::GZ);
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../../LICENSE'), false);
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../../res/satis-schema.json'), false);
     unset($phar);
 }
开发者ID:ausger,项目名称:satis,代码行数:39,代码来源:Compiler.php


示例11: compile

 /**
  * Compiles composer into a single phar file
  *
  * @throws \RuntimeException
  * @param string $pharFile The full path to the file to create
  */
 public function compile($pharFile = 'composer.phar')
 {
     if (file_exists($pharFile)) {
         unlink($pharFile);
     }
     $process = new Process('git log --pretty="%h" -n1 HEAD');
     if ($process->run() != 0) {
         throw new \RuntimeException('The git binary cannot be found.');
     }
     $this->version = trim($process->getOutput());
     $phar = new \Phar($pharFile, 0, 'composer.phar');
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->notName('Compiler.php')->in(__DIR__ . '/..');
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->in(__DIR__ . '/../../vendor/symfony/');
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/.composer/ClassLoader.php'));
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/.composer/autoload.php'));
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/.composer/autoload_namespaces.php'));
     $this->addComposerBin($phar);
     // Stubs
     $phar->setStub($this->getStub());
     $phar->stopBuffering();
     // disabled for interoperability with systems without gzip ext
     // $phar->compressFiles(\Phar::GZ);
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../LICENSE'), false);
     unset($phar);
 }
开发者ID:natxet,项目名称:composer,代码行数:41,代码来源:Compiler.php


示例12: compile

 /**
  * Compiles compify into a single phar file
  *
  * @throws \RuntimeException
  * @param  string            $pharFile The full path to the file to create
  */
 public function compile($pharFile = 'compify.phar')
 {
     if (file_exists($pharFile)) {
         unlink($pharFile);
     }
     $phar = new \Phar($pharFile, 0, 'compify.phar');
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     $finders = array();
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->notName('Compiler.php')->in(__DIR__ . '/../../');
     $finders[] = $finder;
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->name('composer-schema.json')->in(__DIR__ . '/../../../vendor/');
     $finders[] = $finder;
     foreach ($finders as $finder) {
         foreach ($finder as $file) {
             $this->addFile($phar, $file);
         }
     }
     $this->addSatisBin($phar);
     // Stubs
     $phar->setStub($this->getStub());
     $phar->stopBuffering();
     $phar->compressFiles(\Phar::GZ);
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../../LICENSE'), false);
     unset($phar);
 }
开发者ID:stevleibelt,项目名称:compify,代码行数:34,代码来源:Compiler.php


示例13: compile

 /**
  * Compiles composer into a single phar file
  *
  * @throws \RuntimeException
  * @param  string            $pharFile The full path to the file to create
  */
 public function compile($pharName)
 {
     echo "Creating phar archive" . PHP_EOL;
     $this->pharName = $pharName;
     $pharFile = __DIR__ . DIRECTORY_SEPARATOR . $pharName;
     if (file_exists($pharFile)) {
         unlink($pharFile);
     }
     $phar = new \Phar($pharFile, 0, $pharName);
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     foreach ($this->directories as $folder) {
         $finder = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($folder, FilesystemIterator::SKIP_DOTS));
         foreach ($finder as $file) {
             if ($this->isWhitelisted($file) && !$this->isBlacklisted($file)) {
                 $this->addFile($phar, $file);
             }
         }
     }
     $this->addFile($phar, $this->entryPoint);
     // Stubs
     $phar->setStub($this->getStub());
     $phar->stopBuffering();
     unset($phar);
 }
开发者ID:AdrianAulbach,项目名称:db-sync,代码行数:31,代码来源:createphar.php


示例14: compile

 /**
  * Compiles the Slic source code into one single Phar file.
  *
  * @param string $pharFile Name of the output Phar file
  */
 public function compile($pharFile = 'slic.phar')
 {
     if (file_exists($pharFile)) {
         unlink($pharFile);
     }
     $process = new Process('git log --pretty="%h %ci" -n1 HEAD');
     if ($process->run() > 0) {
         throw new \RuntimeException('The git binary cannot be found.');
     }
     $this->version = trim($process->getOutput());
     $phar = new \Phar($pharFile, 0, 'slic.phar');
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     $root = __DIR__ . '/../../..';
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->notName('Compiler.php')->exclude('Tests')->in($root . '/src')->in($root . '/vendor/symfony');
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     $this->addFile($phar, new \SplFileInfo($root . '/LICENSE'), false);
     $this->addFile($phar, new \SplFileInfo($root . '/vendor/autoload.php'));
     $this->addFile($phar, new \SplFileInfo($root . '/vendor/composer/ClassLoader.php'));
     $this->addFile($phar, new \SplFileInfo($root . '/vendor/composer/autoload_namespaces.php'));
     $this->addFile($phar, new \SplFileInfo($root . '/vendor/composer/autoload_classmap.php'));
     $this->addFile($phar, new \SplFileInfo($root . '/vendor/composer/autoload_real.php'));
     // Stubs
     $phar->setStub($this->getStub());
     $phar->stopBuffering();
     // $phar->compressFiles(\Phar::GZ);
     unset($phar);
 }
开发者ID:siphoc,项目名称:slic,代码行数:36,代码来源:Compiler.php


示例15: buildModulePhar

function buildModulePhar($name, $format = Phar::PHAR, $compression = Phar::NONE, $executable = true, $fake = false)
{
    echo "Building {$name}...\t";
    $glob = glob($name.'.*');
    if (count($glob) > 0) {
        foreach ($glob as $file) {
            if (!is_dir($file)) {
                unlink($file);
            }   
        }
    }
    $filename = $name . '.phar';
    $phar = new Phar($filename);
    if ($fake) {
        $phar['Module.php'] = '<?php //no class here';
    } else {
        $phar['Module.php'] = "<?php \n\nnamespace $name;\n\nclass Module\n{}";
    }
    if (false === $executable) {
        $phar->convertToData($format, $compression);
    } else {
        $phar->setDefaultStub('Module.php', 'Module.php');
        if ($format !== Phar::PHAR || $compression !== Phar::NONE) {
            $phar->convertToExecutable($format, $compression);
        }
    }
    if ($format !== Phar::PHAR || $compression !== Phar::NONE) {
        unlink($filename);
    }
    echo "Done!\n";
}
开发者ID:noose,项目名称:zf2,代码行数:31,代码来源:_buildPhars.php


示例16: compile

 /**
  * Compiles shootproof-cli into a single phar file
  *
  * @throws \RuntimeException
  * @param string $pharFile The full path to the file to create
  */
 public function compile($pharFile = 'shootproof-cli.phar')
 {
     if (file_exists($pharFile)) {
         unlink($pharFile);
     }
     $phar = new \Phar($pharFile, 0, 'shootproof-cli.phar');
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../LICENSE'), false);
     $finder = $this->getFinder();
     $finder->files()->ignoreVCS(true)->name('*.php')->notName('Compiler.php')->in(__DIR__);
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     $finder = $this->getFinder();
     $finder->files()->ignoreVCS(true)->name('*.php')->exclude('Tests')->in(__DIR__ . '/../vendor/');
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../bin/config.php'));
     $this->addBin($phar);
     $phar->compressFiles(\Phar::GZ);
     // Stubs
     $phar->setStub($this->getStub());
     $phar->stopBuffering();
     unset($phar);
 }
开发者ID:shootproof,项目名称:shootproof-cli,代码行数:33,代码来源:Compiler.php


示例17: compile

 public function compile($pharFile = 'onesky.phar')
 {
     if (file_exists($pharFile)) {
         unlink($pharFile);
     }
     $phar = new \Phar($pharFile, 0, 'onesky.phar');
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     $finders = array();
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->notName('Compiler.php')->in(__DIR__);
     $finders[] = $finder;
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->in(dirname(__DIR__) . "/vendor");
     $finders[] = $finder;
     foreach ($finders as $finder) {
         foreach ($finder as $file) {
             $this->addFile($phar, $file);
         }
     }
     $this->addBin($phar);
     // Stubs
     $phar->setStub($this->getStub());
     $phar->stopBuffering();
     $phar->compressFiles(\Phar::GZ);
     unset($phar);
 }
开发者ID:skolodyazhnyy,项目名称:onesky-downloader,代码行数:27,代码来源:Compiler.php


示例18: compile

 /**
  * Compiles the Silex source code into one single Phar file.
  *
  * @param string $pharFile Name of the output Phar file
  */
 public function compile($pharFile = 'silex.phar')
 {
     if (file_exists($pharFile)) {
         unlink($pharFile);
     }
     $process = new Process('git log --pretty="%h %ci" -n1 HEAD');
     if ($process->run() > 0) {
         throw new \RuntimeException('The git binary cannot be found.');
     }
     $this->version = trim($process->getOutput());
     $phar = new \Phar($pharFile, 0, 'silex.phar');
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->notName('Compiler.php')->in(__DIR__ . '/..')->in(__DIR__ . '/../../vendor/pimple/pimple/lib')->in(__DIR__ . '/../../vendor/symfony/class-loader/Symfony/Component/ClassLoader')->in(__DIR__ . '/../../vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher')->in(__DIR__ . '/../../vendor/symfony/http-foundation/Symfony/Component/HttpFoundation')->in(__DIR__ . '/../../vendor/symfony/http-kernel/Symfony/Component/HttpKernel')->in(__DIR__ . '/../../vendor/symfony/routing/Symfony/Component/Routing')->in(__DIR__ . '/../../vendor/symfony/browser-kit/Symfony/Component/BrowserKit')->in(__DIR__ . '/../../vendor/symfony/css-selector/Symfony/Component/CssSelector')->in(__DIR__ . '/../../vendor/symfony/dom-crawler/Symfony/Component/DomCrawler');
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../LICENSE'), false);
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/.composer/autoload.php'));
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/.composer/ClassLoader.php'));
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/.composer/autoload_namespaces.php'));
     // Stubs
     $phar->setStub($this->getStub());
     $phar->stopBuffering();
     // $phar->compressFiles(\Phar::GZ);
     unset($phar);
 }
开发者ID:robo47,项目名称:Silex,代码行数:33,代码来源:Compiler.php


示例19: compile

 /**
  * Compile new composer.phar
  * @param string $filename
  */
 public function compile($filename = 'codecept.phar')
 {
     if (file_exists($filename)) {
         unlink($filename);
     }
     $phar = new \Phar($filename, 0, 'codecept.phar');
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->name('*.tpl.dist')->name('*.html.dist')->in($this->compileDir . '/src');
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->name('*.js')->name('*.css')->name('*.png')->name('*.tpl.dist')->name('*.html.dist')->exclude('Tests')->exclude('tests')->exclude('benchmark')->exclude('demo')->in($this->compileDir . '/plugins/frameworks');
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->name('*.css')->name('*.png')->name('*.js')->name('*.css')->name('*.png')->name('*.tpl.dist')->name('*.html.dist')->exclude('Tests')->exclude('tests')->exclude('benchmark')->exclude('demo')->in($this->compileDir . '/vendor');
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     $this->addFile($phar, new \SplFileInfo($this->compileDir . '/autoload.php'));
     $this->setMainExecutable($phar);
     $this->setStub($phar);
     $phar->stopBuffering();
     unset($phar);
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:33,代码来源:Compiler.php


示例20: compile

 /**
  * Compiles composer into a single phar file
  *
  * @throws \RuntimeException
  * @param  string $pharFile The full path to the file to create
  */
 public function compile($pharFile = 'daux.phar')
 {
     if (file_exists($pharFile)) {
         unlink($pharFile);
     }
     $phar = new \Phar($pharFile, 0, 'daux.phar');
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     // Daux
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->name('*.php')->notName('Compiler.php')->in(__DIR__ . '/../templates')->in(__DIR__);
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     // Composer libraries
     $finder = new Finder();
     $finder->files()->ignoreVCS(true)->exclude('Tests')->in(__DIR__ . '/../vendor/symfony/console')->in(__DIR__ . '/../vendor/symfony/polyfill-mbstring')->in(__DIR__ . '/../vendor/guzzlehttp/guzzle/src/')->in(__DIR__ . '/../vendor/guzzlehttp/ringphp/src/')->in(__DIR__ . '/../vendor/guzzlehttp/streams/src/')->in(__DIR__ . '/../vendor/league/commonmark/src/')->in(__DIR__ . '/../vendor/league/plates/src/')->in(__DIR__ . '/../vendor/react/promise/src/')->in(__DIR__ . '/../vendor/webuni/commonmark-table-extension/src/');
     foreach ($finder as $file) {
         $this->addFile($phar, $file);
     }
     // Composer autoload
     $this->addComposer($phar);
     $this->addBinary($phar);
     // Stubs
     $phar->setStub($this->getStub());
     $phar->stopBuffering();
     $this->addFile($phar, new \SplFileInfo(__DIR__ . '/../LICENSE'), false);
     chmod($pharFile, 0775);
     unset($phar);
 }
开发者ID:geeyan,项目名称:daux.io,代码行数:36,代码来源:Compiler.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP PharData类代码示例发布时间:2022-05-23
下一篇:
PHP Phake类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap