| 
#!/usr/bin/env php<?php
 
 /**
 * Antimalware Scanner
 * @author Marco Cesarato <[email protected]>
 * @copyright Copyright (c) 2019
 * @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
 * @link https://github.com/marcocesarato/PHP-Antimalware-Scanner
 */
 
 $root = dirname(__DIR__);
 
 require_once $root . '/vendor/autoload.php';
 
 $input  = $root . '/src/';
 $output = $root . '/dist/scanner.phar';
 $finalOutput = $root . '/dist/scanner';
 
 // clean up
 if (file_exists($output)) {
 unlink($output);
 }
 if (file_exists($output . '.gz')) {
 unlink($output . '.gz');
 }
 if (file_exists($finalOutput)) {
 unlink($finalOutput);
 }
 // create phar
 $p = new Phar($output);
 
 // creating our library using whole directory
 $p->buildFromDirectory($input);
 
 // pointing main file which requires all classes
 $p->setDefaultStub('index.php', '/index.php');
 
 unset($p);
 rename($output, $finalOutput);
 
 echo "$output successfully created";
 |