Skip to content

Instantly share code, notes, and snippets.

@kimikimi714
Last active February 7, 2016 21:52
Show Gist options
  • Save kimikimi714/cc9b503f09ecbdf0cb02 to your computer and use it in GitHub Desktop.
Save kimikimi714/cc9b503f09ecbdf0cb02 to your computer and use it in GitHub Desktop.
How to make valid phar file? (Hello.php puts in hello directory.)
<?php
class Hello {
public function sayHello() {
echo "hello\n";
}
}
<?php
$phar = new Phar('hello.phar', 0, 'hello.phar');
$phar->buildFromDirectory(__DIR__ . '/hello');
$phar->setDefaultStub();
<?php
try {
$file = (new PharFileInfo('phar://' . __DIR__ . '/hello.phar/hello/Hello.php'))->openFile();
var_dump($file);
} catch (Exception $e) {
var_dump($e);
}
@DjJakkiGlass
Copy link

I don't understand how to take the files from an updated plugin and make it into a .phar file on my server. Plz help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment