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. [Utility &amp; Helpers](/categories/utility)
4. /
5. cbednarski/pharcc

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

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

Phar compiler library

v0.2.4(10y ago)274.3k1[3 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 2d 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

30

—

LowBetter than 64% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

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

3965d ago

### Community

Maintainers

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

---

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

[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4723.6M20](/packages/coenjacobs-mozart)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

96374.6k23](/packages/friendsoftypo3-content-blocks)[shyim/danger-php

Port of danger to PHP

8544.9k](/packages/shyim-danger-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)

PHPackages © 2026

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