PHP Classes

File: bin/build

Recommend this page to a friend!
  Classes of Marco Cesarato   PHP Malware Scanner Free Tool   bin/build   Download  
File: bin/build
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Malware Scanner Free Tool
Scan PHP files to find malicious code
Author: By
Last change: Update of bin/build
Date: 2 years ago
Size: 956 bytes
 

Contents

Class file image Download
#!/usr/bin/env php
<?php

/**
 * Antimalware Scanner
 * @author Marco Cesarato <cesarato.developer@gmail.com>
 * @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";