PHPackages                             cbednarski/pharcc - 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. [CLI &amp; Console](/categories/cli)
4. /
5. cbednarski/pharcc

AbandonedArchivedLibrary[CLI &amp; Console](/categories/cli)

cbednarski/pharcc
=================

Phar compiler library

v0.2.4(10y ago)274.3k1[2 issues](https://github.com/cbednarski/pharcc/issues)[1 PRs](https://github.com/cbednarski/pharcc/pulls)MITPHP

Since Sep 4Pushed 10y ago1 watchersCompare

[ Source](https://github.com/cbednarski/pharcc)[ Packagist](https://packagist.org/packages/cbednarski/pharcc)[ RSS](/packages/cbednarski-pharcc/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (4)Versions (7)Used By (0)

pharcc
======

[](#pharcc)

pharcc is a command-line tool that converts your php project into a single, executable `.phar` file for easy distribution.

[![Build Status](https://camo.githubusercontent.com/d7392673bbe3d15c7fe2c7ce25ccd371b602b79cc0ce82d577f757eb5888d4b9/68747470733a2f2f7472617669732d63692e6f72672f636265646e6172736b692f7068617263632e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/cbednarski/pharcc) [![Roadmap Items](https://camo.githubusercontent.com/34f25bbc0df9fac61f90186a04ff177eaf4559054d2a0ce4e2f04bbac23aa13c/68747470733a2f2f62616467652e776166666c652e696f2f636265646e6172736b692f7068617263632e706e673f6c6162656c3d7265616479)](https://waffle.io/cbednarski/pharcc)

### Installation

[](#installation)

pharcc requires php 5.3+. You must also set `phar.readonly = Off` in your `php.ini` or you will be unable to compile `.phar` files.

#### Via `.phar`

[](#via-phar)

The easiest way to get it working is to download a tagged [`pharcc.phar`](https://github.com/cbednarski/pharcc/releases) release, and put this on your path. For example:

```
$ wget https://github.com/cbednarski/pharcc/releases/download/v0.2.3/pharcc.phar
$ chmod +x pharcc.phar
$ sudo mv pharcc.phar /usr/local/bin/pharcc

```

#### Other ways

[](#other-ways)

Composer (thanks [@clue](https://github.com/clue)):

```
$ composer global require cbednarski/pharcc=dev-master
$ echo 'export PATH=$PATH:$HOME/.composer/vendor/bin' >> ~/.bash_profile

```

From source:

```
$ git clone https://github.com/cbednarski/pharcc
$ cd pharcc
$ make install      # For using
$ make install-dev  # For hacking

```

### Usage

[](#usage)

pharcc is a command-line tool that examines your project and produces a `.phar` file. `cd` into your project root and run the following:

```
$ pharcc init
$ pharcc build

```

You can also use pharcc as a library and call the internals directly, but if you do that I'm going to assume you're comfortable reading the code yourself. It's pretty short. Comments are welcome!

### How it works

[](#how-it-works)

A phar is essentially a slew of php files that are concatenated together to create a single, executable php file, complete with assets and such. pharcc reads a [`.pharcc.yml`](https://github.com/cbednarski/pharcc/blob/master/src/cbednarski/Pharcc/Resources/pharcc.yml) file from the root of your project and, combined with some assumed conventions, builds an executable phar for you.

I assume the following:

- You're using a [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) project structure (more below)
- Your app is a console application

Based on our assumptions, I've selected some sensible defaults for which files to include or exclude from your `.phar` file, which you can customize by editing the `.pharcc.yml` file. If your application is not a console app, you can omit `main` from the config.

### Your Project Layout

[](#your-project-layout)

I assume your project layout looks something like this, which is pretty standard for PSR-0 applications:

```
.
├── LICENSE
├── bin
│   └── pharcc
├── composer.json
├── readme.md
├── src
│   └── cbednarski
│       └── Pharcc
├── tests
│   └── cbednarski
│       └── Pharcc
└── vendor
    ├── autoload.php
    ├── cbednarski
    │   └── fileutils
    ├── composer
    │   ├── ClassLoader.php
    └── symfony
        ├── console
        ├── finder
        └── yaml

```

If your application doesn't look like this pharcc will probably still work, but you'll need to tweak your `.pharcc.yml` with some other appropriate includes / excludes.

### Version Reporting

[](#version-reporting)

If your project is in git, uses semver tags for releases, and uses the symfony console component, pharcc can report the version of your application on the commandline. For example:

```
$ pharcc --version
pharcc version 0.2.3

```

To make this work in your app, you'll need to add `cbednarski\Pharcc\Git::getVersion(__DIR__)` to your bin file.

```
use cbednarski\Pharcc\Git;

$application = new Symfony\Component\Console\Application('pharcc', Git::getVersion(__DIR__));
```

Note: The current implementation is pretty magic, and only works if you worship the git, semver, and symfony console component gods.

### Contributing

[](#contributing)

Contributions are welcome! Please don't hesitate to file a bug, pull-request a feature, or let me know what could be made easier to use.

Check out the list of ready-for-dev items here: [![Roadmap Items](https://camo.githubusercontent.com/34f25bbc0df9fac61f90186a04ff177eaf4559054d2a0ce4e2f04bbac23aa13c/68747470733a2f2f62616467652e776166666c652e696f2f636265646e6172736b692f7068617263632e706e673f6c6162656c3d7265616479)](https://waffle.io/cbednarski/pharcc) Here are some guidelines to follow:

- The spirit of this project is to be simple and solve the general use case of creating phar files. It currently supports console applications and I'm willing to accept pull requests to add the ability to make a web app phar, like the one for phpMyAdmin, and a self-update command. Other large features, maybe. Get in touch.
- If you file a bug please include steps to repro, or even better, link me to a git hash that's failing to compile properly (make sure it includes your `.pharcc.yml` file).
- Code follows PSR-2 formatting rules. Use [php-cs-fixer](https://github.com/fabpot/PHP-CS-Fixer) to reformat your code before you PR.
- Use phpunit to run the unit tests and make sure they pass.
- Please add tests if you add a feature or fix a bug.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.9% of commits — single point of failure

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 ~134 days

Recently: every ~166 days

Total

6

Last Release

3966d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ab13cd26663bc7b83035f44ddbb607176d6192e5e9f2a4766477058f3bfdf34?d=identicon)[cbednarski](/maintainers/cbednarski)

---

Top Contributors

[![cbednarski](https://avatars.githubusercontent.com/u/649798?v=4)](https://github.com/cbednarski "cbednarski (63 commits)")[![andrejpavlovic](https://avatars.githubusercontent.com/u/983644?v=4)](https://github.com/andrejpavlovic "andrejpavlovic (1 commits)")[![clue](https://avatars.githubusercontent.com/u/776829?v=4)](https://github.com/clue "clue (1 commits)")

---

Tags

clipharphp

### Embed Badge

![Health badge](/badges/cbednarski-pharcc/health.svg)

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

###  Alternatives

[drush/drush

Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.

2.4k57.4M685](/packages/drush-drush)[humbug/php-scoper

Prefixes all PHP namespaces in a file or directory.

7963.0M35](/packages/humbug-php-scoper)[phpcr/phpcr-shell

Shell for PHPCR

721.3M8](/packages/phpcr-phpcr-shell)[crunzphp/crunz

Schedule your tasks right from the code.

2292.0M6](/packages/crunzphp-crunz)[crazywhalecc/static-php-cli

Build single static PHP binary, with PHP project together, with popular extensions included.

1.8k13.9k](/packages/crazywhalecc-static-php-cli)[madewithlove/license-checker

CLI tool to verify allowed licenses for composer dependencies

54449.8k21](/packages/madewithlove-license-checker)

PHPackages © 2026

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