This library provides a generic PHP PHAR compiler.
$compiler = new Compiler(PROJECT_PATH);
$compiler->addIndexFile('bin/mycoolprogram.php');
$compiler->addDirectory('libraries');
$compiler->addFile('vendor/autoload.php');
$compiler->addDirectory('vendor/composer', '!*.php'); // Exclude non-PHP files
$compiler->addDirectory('vendor/.../Component/Console', ['Tests/*', '!*.php']);
$compiler->compile("$outputDir/mycoolprogram.phar");
Install Composer if you don't already have it present on your system.
To install the library, run the following command and you will get the latest version:
$ composer require secondtruth/phar-compiler
- You must have at least PHP version 5.6 installed on your system.