-$package = new \Phar($tmpname, 0, "pharext.phar");
-$package->buildFromDirectory(dirname(__DIR__)."/src", "/^.*\.php$/");
-$package->setDefaultStub("pharext_packager.php");
-$package->setStub("#!/usr/bin/php -dphar.readonly=0\n".$package->getStub());
-unset($package);
+$file = (new pharext\Task\PharBuild(null, pharext\Metadata::all() + [
+ "name" => "pharext",
+ "stub" => "pharext_packager.php",
+ "license" => file_get_contents(__DIR__."/../LICENSE")
+], false))->run();