PHPackages                             cyberspectrum/pharpiler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. cyberspectrum/pharpiler

ActiveProject[Utility &amp; Helpers](/categories/utility)

cyberspectrum/pharpiler
=======================

Creates a phar from any composer based project - highly configurable

1.0.8(7y ago)6249MITPHP ^5.6 | ^7.0

Since Nov 24Compare

[ Source](https://github.com/cyberspectrum/pharpiler)[ Packagist](https://packagist.org/packages/cyberspectrum/pharpiler)[ RSS](/packages/cyberspectrum-pharpiler/feed)WikiDiscussions Synced 2w ago

READMEChangelogDependencies (8)Versions (11)Used By (0)

[![Build Status](https://camo.githubusercontent.com/ad08f814973394c54c8bdb7dd0f915929223c557d83b11968bfbc288ac131f0f/68747470733a2f2f7472617669732d63692e6f72672f6379626572737065637472756d2f7068617270696c65722e706e67)](https://travis-ci.org/cyberspectrum/pharpiler)[![Latest Version tagged](https://camo.githubusercontent.com/45d7b6cebc0be0accf11ba8c06227213ec4ad25b7859b3889f083445585dd9a7/687474703a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f6379626572737065637472756d2f7068617270696c65722e737667)](https://github.com/cyberspectrum/pharpiler/tags)[![Latest Version on Packagist](https://camo.githubusercontent.com/0e421f5348240955407197cecdbcdba3ccf378a36203e672d43e135484377314/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6379626572737065637472756d2f7068617270696c65722e737667)](https://packagist.org/packages/cyberspectrum/pharpiler)[![Installations via composer per month](https://camo.githubusercontent.com/6dd30421159f1856174dc53925ac491ec2c5fa79a5abe9087e8f707c913fb4fb/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6379626572737065637472756d2f7068617270696c65722e737667)](https://packagist.org/packages/cyberspectrum/pharpiler)

What is Pharpiler?
==================

[](#what-is-pharpiler)

Pharpiler is a simple, yet highly configurable, command line tool to compile composer based php projects into a phar file.

Why Pharpiler?
==============

[](#why-pharpiler)

I (@discordier) got tired of writing custom compile scripts for each and every phar project I was developing over and over again which mostly consisted of copy&amp;paste code from each project. Hence there definately was need for reduction of code duplication and so Pharpiler was born.

How to use?
===========

[](#how-to-use)

In your project run `composer require --dev cyberspectrum/pharpiler` and create a `.pharpiler.yml` in your project root.

Configuration
=============

[](#configuration)

The `.pharpiler.yml` allows for many configuration options, have a look at the [configuration](https://github.com/cyberspectrum/pharpiler/blob/master/.pharpiler.yml)of Pharpiler itself in this repository (yes, Pharpiler compiles itself).

Within the configuration you may use certain parameters.

You may define own parameters in the root level to reduce recurrences. Example:

```
parameters:
  - my-parameter: "Hello World"
```

However, Pharpiler registers some parameters for each package to ease configuration. Package root dir: `%package:[vendor]/[package-name]%`Package version: `%version:[vendor]/[package-name]%`Package release date: `%date:[vendor]/[package-name]%`

```
# First off, tell what the desired phar name should be.
phar: pharpiler.phar

# Now we need to declare some compile tasks.
tasks:
  # We want to add a composer package.
  - type: add-package

    # The name of the package.
    # NOTE: you most likely. want to add your root package here as first.
    name: cyberspectrum/pharpiler

    # Optional flag to include all requirements of the package
    # default: true
    # You may specify a list of package names instead of true or false.
    # include_require: true

    # Optional flag to include all development requirements of the package.
    # default: false
    # You may specify a list of package names instead of true or false.
    # include_requiredev: false

    # Optionally list package names that shall get omitted.
    exclude_dependencies:
    #  - phpcq/all-tasks

    # Define file name pattern for files to get included.
    # You can specify glob and regex patterns here.
    # NOTE: this example makes use of YAML references.
    include_files: &default_include_files
      # Include all php files.
      - "*.php"
      # Include all the license files.
      - "(LICENSE\\.?.*)"
    # Define file name patterns of files to exclude.
    # You can specify glob and regex patterns here.
    # NOTE: this example makes use of YAML references.
    exclude_files: &default_exclude_files
      # We do not want to include unit tests.
      - "(.*[Tt]ests?\/)"
      - "*tests/*.php"

    # You may override the "include_files", "exclude_files" on a per package
    # basis and can even move files around by specifying "rewrite_paths".
    package_override:
      # Override settings for package "cyberspectrum/pharpiler"
      cyberspectrum/pharpiler:
        include_files:
          # Import the previously defined default includes.
          - *default_include_files
          # Additionally add the file "bin/pharpiler" from said package.
          - "%package:cyberspectrum/pharpiler%/bin/pharpiler"
        exclude_files:
          # Import the previously defined default excludes.
          - *default_exclude_files
          # Additionally omit the files within phar directories.
          - "*/phar/*"
        rewrite_paths:
          # Here you can rewrite path portions.
          src: /src

      # Symfony has some tester classes we do not want to add - so let's skip them.
      symfony/console:
        exclude_files:
          - *default_exclude_files
          - "(Tester\/)"

  # A real phar file needs a stub, here you tell pharpiler to set it.
  - type: set-stub
    # The stub file must be accessible from anywhere within the composer project.
    stub_file: %package:cyberspectrum/pharpiler%/phar/stub.php

  # We most of the times also need to add the autoload information.
  - type: composer-autoload
    # Pharpiler can optimize the autoload information to remove anything which
    # got excluded by any other setting.
    # Default: true
    optimize: true

# For some files it is necessary to alter the file contents.
# To do so, you may specify a list of filters which alter file contents.
# Currently there are the following types of filters registered:
# - replace      Which performs simple search and replace on the file contents.
# - php-strip    Which removes all comments and trailing whitespace while
#                maintaining line numbers.
# - warning-time Creates a timestamp in the future - useful for selfupdate
#                notices etc.
rewrites:
    # Define the file names to be matched by this rewrite.
  - files:
      - %package:cyberspectrum/pharpiler%/phar/stub.php
      - %package:cyberspectrum/pharpiler%/bin/pharpiler
    # Define a list of filters to apply on these files.
    filter:
      # Search for "@@MIN_PHP_VERSION@@" and replace it with "5.5"
      - type: replace

        @@MIN_PHP_VERSION@@: "5.5"
      # Search for "@@PHARPILER_VERSION@@" and replace it with the installed version.
      - type: replace
        @@PHARPILER_VERSION@@: %version:cyberspectrum/pharpiler%

      # Search for "// @@DEV_WARNING_TIME@@" and replace it with the given define.
      # The magic value "@@warning_time@@" will get replaced with the calculated timestamp.
      - type: warning-time
        search: // @@DEV_WARNING_TIME@@
        format: define('DEV_WARNING_TIME', @@warning_time@@);
        # The ahead value is: 30 * 24 * 3600 = 2592000, hence 30 days.
        ahead: 2592000

  # This removes the shebang line from the passed script.
  - files:
      - %package:cyberspectrum/pharpiler%/bin/pharpiler
    filter:
      - type: replace
        "#!/usr/bin/env php\n": ""

  # You most likely want to keep the php-strip filter at the end as otherwise
  # comments will get stripped that should get replaced by other filters, like
  # the "warning-time".
  - files: "*.php"
    filter:
      - type: php-strip
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity64

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~130 days

Recently: every ~254 days

Total

9

Last Release

2876d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.5

1.0.8PHP ^5.6 | ^7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/44649522?v=4)[xtra](/maintainers/xtra)[@xtra](https://github.com/xtra)

### Embed Badge

![Health badge](/badges/cyberspectrum-pharpiler/health.svg)

```
[![Health](https://phpackages.com/badges/cyberspectrum-pharpiler/health.svg)](https://phpackages.com/packages/cyberspectrum-pharpiler)
```

###  Alternatives

[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M668](/packages/shopware-core)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M776](/packages/sylius-sylius)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19467.3M1.9k](/packages/drupal-core)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M231](/packages/sulu-sulu)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
