secondtruth/phar-compiler

Generic PHP PHAR compiler

Maintainers

👁 secondtruth

Package info

github.com/secondtruth/php-phar-compiler

Homepage

pkg:composer/secondtruth/phar-compiler

Fund package maintenance!

Liberapay

Patreon

Statistics

Installs: 3 368

Dependents: 4

Suggesters: 0

Stars: 26

Open Issues: 0

v1.2.0 2020-08-16 18:02 UTC

Requires

  • php: >=5.6

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

ISC ad9f6060185cf682e4cfe2c5909d396cd947dc6f

compilerphar

This package is auto-updated.

Last update: 2026-06-17 02:26:38 UTC


README

👁 Latest Stable
👁 Build Status
👁 Scrutinizer
👁 Coverage
👁 License

This library provides a generic PHP PHAR compiler.

How to use?

$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");

Installation

Install via Composer

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

Requirements

  • You must have at least PHP version 5.6 installed on your system.