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

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

macfja/composer-phar-bin
========================

Composer plugin to replace dev dependencies by Phar

1.0.1(6y ago)044MITPHPPHP ^7.1

Since Apr 5Pushed 6y ago1 watchersCompare

[ Source](https://github.com/MacFJA/composer-phar-bin)[ Packagist](https://packagist.org/packages/macfja/composer-phar-bin)[ RSS](/packages/macfja-composer-phar-bin/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (16)Versions (3)Used By (0)

Composer Phar Bin plugin
========================

[](#composer-phar-bin-plugin)

The plugin replace development dependencies by their Phar.

Why ?
-----

[](#why-)

I encounter several times a dependency lock on dev tool (code quality, documentation generation, etc.), and most of the time those tool have a Phar binary.

To manage those Phar, solution already exist, like [Phive](https://phar.io/), but it's an another tool to install, another set of commands to run.

So, I create this Composer plugin to integrate Phive into Composer in the less visible way.

How it's works ?
----------------

[](#how-its-works-)

When run `composer install`, `composer update`, or `composer require`, the plugin will check if any of your *`require-dev`* packages exist in the Phive repository. If found then Phive will link the Phar in your composer binaries so scripts will continue to work and the dependency will be ignore (so its sub-dependencies).

Installation
------------

[](#installation)

Simply run: `composer require macfja/composer-phar-bin`, and then a `composer install`.
Or globally: `composer global require macfja/composer-phar-bin`.

Any later `composer install`, `composer update`, or `composer require` will trigger the dependencies replacement.

How prevent a package to be replace ?
-------------------------------------

[](#how-prevent-a-package-to-be-replace-)

If for some reason need a package known by Phive to not be replace by its Phar, you can add in you (root) `composer.json` a list of package to don't replace.

In the `extra` section add `composer-phar-bin` object that contains an array named `exclude` of Composer packages.

### Example

[](#example)

In the following example, `phpunit/phpunit` will be downloaded and managed by Composer, but `phan/phan` will be replace by its Phar.

```
{
    "name": "macfja/composer-phar-bin-test",
    "require-dev": {
        "macfja/composer-phar-bin": "^1.0.0",
        "phpunit/phpunit": "^9.1",
        "phan/phan": "^2.7"
    },
    "extra": {
        "composer-phar-bin": {
            "exclude": ["phpunit/phpunit"]
        }
    }
}
```

Limitation
----------

[](#limitation)

The plugin only work after been installed. That seem obvious but there are cases which are tedious to understand because of this.

### Dependencies conflicts on new a environment

[](#dependencies-conflicts-on-new-a-environment)

Let's imagine that you use the plugin and you have *virtually* some conflict. Everything work fine, the plugin replace conflicting libraries with their Phar.

Someone want to install the project, but Composer complaint about some packages ("Your requirements could not be resolved to an installable set of packages.").

The reason is probably because you don't commit your `composer.lock` file, so Composer is trying to solve all dependencies, and as our plugin is not yet installed and loaded, it can't do its magic.

#### How to solve this ?

[](#how-to-solve-this-)

You have several solutions to solve this:

- you can commit your `composer.lock` file
- you can generate it gradually: remove all dev dependencies, then install your project (`composer install`), and now readd all you dev dependencies
- you can install the plugin globally (so it will always be loaded)

### Missing phars on fresh install

[](#missing-phars-on-fresh-install)

You download a project with a `composer.lock`, run `composer install`.

Everything seem ok, but when you first run a composer script, Composer complain about missing file.

The issue here is that the Composer read the `composer.lock` file, and so only install your dependencies, excluding the ones that are manage by our plugin. But as the plugin is not loaded (because not yet installed) it doesn't install phar.

#### How to solve this ?

[](#how-to-solve-this--1)

You have two options:

- simply rerun `composer install`
- install the plugin globally (so it will always be loaded)

Contributing
------------

[](#contributing)

You can contribute to the library. To do so, you have Github issues to:

- ask your question
- request any change (typo, bad code, etc.)
- and much more...

You also have PR to:

- suggest a correction
- and much more...

### Local installation

[](#local-installation)

First clone the project (either this repository, or your fork), next run:

```
make install # Install project vendor
make all # Run QA tools + generate docs
```

### Validate your code

[](#validate-your-code)

When you done writing your code run the following command check if the quality meet defined rule and to format it:

```
make analyze # Run QA tools
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~25 days

Total

2

Last Release

2200d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e35bfbefc89c6998a77e2bf9ef3da42d80513b57cb9ae209b6c39b92a96097b3?d=identicon)[MacFJA](/maintainers/MacFJA)

---

Top Contributors

[![MacFJA](https://avatars.githubusercontent.com/u/1475671?v=4)](https://github.com/MacFJA "MacFJA (3 commits)")

---

Tags

composer-pluginpharphiveplugincomposerpharphivephar-io

###  Code Quality

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[ergebnis/composer-normalize

Provides a composer plugin for normalizing composer.json.

1.1k37.3M2.1k](/packages/ergebnis-composer-normalize)[pyrech/composer-changelogs

Display changelogs after each composer update

5904.0M25](/packages/pyrech-composer-changelogs)[clue/phar-composer

Simple phar creation for any project managed via Composer

862881.6k29](/packages/clue-phar-composer)[sllh/composer-versions-check

Checks if packages are up to date to last major versions after update

2352.4M16](/packages/sllh-composer-versions-check)[ffraenz/private-composer-installer

A composer install helper for private packages

2331.7M5](/packages/ffraenz-private-composer-installer)[automattic/jetpack-autoloader

Creates a custom autoloader for a plugin or theme.

525.5M67](/packages/automattic-jetpack-autoloader)

PHPackages © 2026

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