PHPackages                             clue/phar-composer - 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. clue/phar-composer

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

clue/phar-composer
==================

Simple phar creation for any project managed via Composer

v1.4.0(4y ago)862881.6k↑19.4%79[8 issues](https://github.com/clue/phar-composer/issues)[6 PRs](https://github.com/clue/phar-composer/pulls)20MITPHPPHP &gt;=5.3.6CI passing

Since May 18Pushed 9mo ago34 watchersCompare

[ Source](https://github.com/clue/phar-composer)[ Packagist](https://packagist.org/packages/clue/phar-composer)[ Docs](https://github.com/clue/phar-composer)[ Fund](https://clue.engineering/support)[ GitHub Sponsors](https://github.com/clue)[ RSS](/packages/clue-phar-composer/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (13)Used By (20)

clue/phar-composer
==================

[](#cluephar-composer)

[![CI status](https://github.com/clue/phar-composer/workflows/CI/badge.svg)](https://github.com/clue/phar-composer/actions)[![downloads on GitHub](https://camo.githubusercontent.com/3e49ac03acceed2d846ec47119f2774a4474cc7be8b3063ecefd9cee8d98dcbd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f636c75652f706861722d636f6d706f7365722f746f74616c3f636f6c6f723d626c7565266c6162656c3d646f776e6c6f6164732532306f6e253230476974487562)](https://github.com/clue/phar-composer/releases)[![installs on Packagist](https://camo.githubusercontent.com/a125f25e4c6a138f5cc8ba02f8b055aaea9545b18c619102bab3b47ac674ea32/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636c75652f706861722d636f6d706f7365723f636f6c6f723d626c7565266c6162656c3d696e7374616c6c732532306f6e2532305061636b6167697374)](https://packagist.org/packages/clue/phar-composer)

Simple phar creation for any project managed via Composer.

It takes your existing project's `composer.json` and builds an executable phar for your project among with its bundled dependencies.

- Create a single executable phar archive, including its dependencies (i.e. vendor directory included)
- Automated build process
- Zero additional configuration

**Table of contents**

- [Support us](#support-us)
- [Usage](#usage)
    - [phar-composer](#phar-composer)
    - [phar-composer build](#phar-composer-build)
    - [phar-composer install](#phar-composer-install)
    - [phar-composer search](#phar-composer-search)
- [Install](#install)
    - [As a phar (recommended)](#as-a-phar-recommended)
    - [Installation using Composer](#installation-using-composer)
- [Development](#development)
- [Tests](#tests)
- [License](#license)

Support us
----------

[](#support-us)

We invest a lot of time developing, maintaining and updating our awesome open-source projects. You can help us sustain this high-quality of our work by [becoming a sponsor on GitHub](https://github.com/sponsors/clue). Sponsors get numerous benefits in return, see our [sponsoring page](https://github.com/sponsors/clue)for details.

Let's take these projects to the next level together! 🚀

Usage
-----

[](#usage)

Once clue/phar-composer is [installed](#install), you can use it via command line like this.

### phar-composer

[](#phar-composer)

This tool supports several sub-commands. To get you started, you can now use the following simple command:

```
$ phar-composer
```

This will actually execute the `search` command that allows you to interactively search and build any package listed on packagist (see below description of the [search command](#phar-composer-search) for more details).

### phar-composer build

[](#phar-composer-build)

The `build` command can be used to build an executable single-file phar (php archive) for any project managed by composer:

```
$ phar-composer build ~/path/to/your/project
```

The second argument can be pretty much everything that can be resolved to a valid project managed by composer. Besides creating phar archives for locally installed packages like above, you can also easily download and bundle packages from packagist.org like this:

```
$ phar-composer build d11wtq/boris
```

The above will download and install the latest stable tagged release (if any). You can also specify a tagged version like this:

```
$ phar-composer build clue/phar-composer:~1.0
```

Or you can specify to install the head of a given branch like this:

```
$ phar-composer build clue/phar-composer:dev-master
```

A similar syntax can be used to clone a package from any git URL. This is particularly useful for private packages or temporary git clones not otherwise listed on packagist:

```
$ phar-composer build https://github.com/composer/composer.git
```

The above will clone the repository and check out the default branch. Again, you can specify either a tag or branch name very similar to how composer works:

```
$ phar-composer build https://github.com/composer/composer.git:dev-master
```

### phar-composer install

[](#phar-composer-install)

The `install` command will both build the given package and then install it into the system-wide bin directory `/usr/local/bin` (usually already in your `$PATH`). This works for any package name or URL just like with the `build` command, e.g.:

```
$ phar-composer install phpunit/phpunit
```

After some (lengthy) build output, you should now be able to run it by just issuing:

```
$ phpunit
```

> In essence, the `install` command will basically just issue a `build` and then `sudo mv $target.phar /usr/local/bin/$target`. It will ask you for your sudo password when necessary, so it's not needed (and in fact not *recommended*) to run the whole comamnd via `sudo`.
>
> Windows limitation: Note that this subcommand is not available on Windows. Please use the `build` command and place Phar in your `$PATH` manually.

### phar-composer search

[](#phar-composer-search)

The `search` command provides an interactive command line search. It will ask for the package name and issue an search via packagist.org's API and present a list of matching packages. So if you don't know the exact package name, you can use the following command:

```
$ phar-composer search boris
```

It uses an interactive command line menu to ask you for the matching package name, its version and will then offer you to either `build` or `install` it.

Install
-------

[](#install)

You can grab a copy of clue/phar-composer in either of the following ways.

This project aims to run on any platform and thus does not require any PHP extensions and supports running on legacy PHP 5.3 through current PHP 8+. It's *highly recommended to use the latest supported PHP version* for this project.

### As a phar (recommended)

[](#as-a-phar-recommended)

You can simply download a pre-compiled and ready-to-use version as a Phar to any directory. You can simply download the latest `phar-composer.phar` file from our [releases page](https://github.com/clue/phar-composer/releases). The [latest release](https://github.com/clue/phar-composer/releases/latest) can always be downloaded like this:

```
$ curl -JOL https://clue.engineering/phar-composer-latest.phar
```

That's it already. Once downloaded, you can verify everything works by running this:

```
$ cd ~/Downloads
$ php phar-composer.phar --version
```

The above usage examples assume you've installed phar-composer system-wide to your $PATH (recommended), so you have the following options:

1. Only use phar-composer locally and adjust the usage examples: So instead of running `$ phar-composer --version`, you have to type `$ php phar-composer.phar --version`.
2. Use phar-composer's `install` command to install itself to your $PATH by running:

    ```
    $ php phar-composer.phar install clue/phar-composer
    ```
3. Or you can manually make the `phar-composer.phar` executable and move it to your $PATH by running:

```
$ chmod 755 phar-composer.phar
$ sudo mv phar-composer.phar /usr/local/bin/phar-composer
```

If you have installed phar-composer system-wide, you can now verify everything works by running:

```
$ phar-composer --version
```

There's no separate `update` procedure, simply download the latest release again and overwrite the existing phar.

Again, if you have already installed phar-composer system-wide, updating is as easy as running a self-installation like this:

```
$ phar-composer install clue/phar-composer
```

### Installation using Composer

[](#installation-using-composer)

Alternatively, you can also install phar-composer as part of your development dependencies. You will likely want to use the `require-dev` section to exclude phar-composer in your production environment.

You can either modify your `composer.json` manually or run the following command to include the latest tagged release:

```
$ composer require --dev clue/phar-composer
```

Now you should be able to invoke the following command in your project root:

```
$ vendor/bin/phar-composer --version
```

> Note: You should only invoke and rely on the main phar-composer bin file. Installing this project as a non-dev dependency in order to use its source code as a library is *not supported*.

To update to the latest release, just run `composer update clue/graph-composer`.

Development
-----------

[](#development)

clue/phar-composer is an [open-source project](#license) and encourages everybody to participate in its development. You're interested in checking out how clue/phar-composer works under the hood and/or want to contribute to the development of clue/phar-composer? Then this section is for you!

The recommended way to install clue/phar-composer is to clone (or download) this repository and use [Composer](https://getcomposer.org/) to download its dependencies. Therefore you'll need PHP, Composer, git and curl installed. For example, on a recent Ubuntu/Debian-based system, simply run:

```
$ sudo apt install php-cli git curl

$ git clone https://github.com/clue/phar-composer.git
$ cd phar-composer

$ curl -s https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer

$ composer install
```

You can now verify everything works by running clue/phar-composer like this:

```
$ php bin/phar-composer --version
```

If you want to distribute clue/phar-composer as a single standalone release file, you may compile the project into a single `phar-composer.phar` file like this:

```
$ composer build
```

> Note that compiling will temporarily install a copy of this project to the local `build/` directory and install all non-development dependencies for distribution. This should only take a second or two if you've previously installed its dependencies already. The build script optionally accepts the version number (`VERSION` env) and an output file name or will otherwise try to look up the last release tag, such as `phar-composer-1.0.0.phar`.

You can now verify the resulting `phar-composer.phar` file works by running it like this:

```
$ php phar-composer.phar --version
```

To update your development version to the latest version, just run this:

```
$ git pull
$ composer install
```

Made some changes to your local development version?

Make sure to let the world know! ![:shipit:](https://github.githubassets.com/images/icons/emoji/shipit.png ":shipit:")We welcome PRs and would love to hear from you!

Happy hacking!

Tests
-----

[](#tests)

To run the test suite, you first need to clone this repo and then install all dependencies [through Composer](https://getcomposer.org/):

```
$ composer install
```

To run the test suite, go to the project root and run:

```
$ vendor/bin/phpunit
```

License
-------

[](#license)

This project is released under the permissive [MIT license](LICENSE).

This project bundles the `StubGenerator` and `Extract` classes with minor changes from the original herrera-io/box v1.6.1 licensed under MIT which no longer has an installable candidate. Copyright (c) 2013 Kevin Herrera.

> Did you know that I offer custom development services and issuing invoices for sponsorships of releases and for contributions? Contact me (@clue) for details.

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance41

Moderate activity, may be stable

Popularity62

Solid adoption and visibility

Community38

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 91.5% 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 ~371 days

Recently: every ~521 days

Total

13

Last Release

285d ago

Major Versions

v0.5.0 → v1.0.02015-11-15

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/776829?v=4)[Christian Lück](/maintainers/clue)[@clue](https://github.com/clue)

---

Top Contributors

[![clue](https://avatars.githubusercontent.com/u/776829?v=4)](https://github.com/clue "clue (205 commits)")[![SimonFrings](https://avatars.githubusercontent.com/u/44357440?v=4)](https://github.com/SimonFrings "SimonFrings (9 commits)")[![radford](https://avatars.githubusercontent.com/u/55631?v=4)](https://github.com/radford "radford (3 commits)")[![PaulRotmann](https://avatars.githubusercontent.com/u/85174210?v=4)](https://github.com/PaulRotmann "PaulRotmann (2 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (2 commits)")[![icedream](https://avatars.githubusercontent.com/u/807772?v=4)](https://github.com/icedream "icedream (1 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (1 commits)")[![thojou](https://avatars.githubusercontent.com/u/21999844?v=4)](https://github.com/thojou "thojou (1 commits)")

---

Tags

composerpharexecutable pharbuild processbundle dependencies

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/clue-phar-composer/health.svg)

```
[![Health](https://phpackages.com/badges/clue-phar-composer/health.svg)](https://phpackages.com/packages/clue-phar-composer)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[franzl/studio

Develop your Composer libraries with style

1.1k634.5k15](/packages/franzl-studio)[shyim/danger-php

Port of danger to PHP

8544.9k](/packages/shyim-danger-php)[tm/tooly-composer-script

Simple composer script to manage phar files.

103280.1k32](/packages/tm-tooly-composer-script)[jbzoo/composer-diff

See what has changed after a composer update.

53888.9k1](/packages/jbzoo-composer-diff)

PHPackages © 2026

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