Skip to content

Instantly share code, notes, and snippets.

@kimikimi714
Last active August 29, 2015 14:03
Show Gist options
  • Save kimikimi714/80d18f829b2377baff5a to your computer and use it in GitHub Desktop.
Save kimikimi714/80d18f829b2377baff5a to your computer and use it in GitHub Desktop.
うまくいったpharファイル作成テスト。Hello.phpはhttps://gist.github.com/kimikimi714/cc9b503f09ecbdf0cb02 と同じで、make_phar.phpとopen_phar.phpを修正した。またスタブとしてhello直下にmain.phpをおいてる
#!/bin/bash
php -d phar.readonly=0 make_phar.php
php open_test.php
<?php
require_once __DIR__ . '/Hello.php';
<?php
$phar = new Phar('hello.phar', FilesystemIterator::CURRENT_AS_FILEINFO, 'hello.phar');
$phar->buildFromDirectory(__DIR__ . '/hello/');
$phar->setStub($phar->createDefaultStub('main.php'));
<?php
require_once 'phar://' . __DIR__ . '/hello.phar';
(new Hello())->sayHello();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment