PHPackages                             jonpugh/composer-project-bins - 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. jonpugh/composer-project-bins

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

jonpugh/composer-project-bins
=============================

Include bin scripts in top level composer projects.

2.1.0(2y ago)1183MITPHP

Since Jan 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/operations-project/composer-project-bin-scripts)[ Packagist](https://packagist.org/packages/jonpugh/composer-project-bins)[ RSS](/packages/jonpugh-composer-project-bins/feed)WikiDiscussions 2.x Synced 1mo ago

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

Project Bin Scripts
===================

[](#project-bin-scripts)

Your scripts in the Composer bin-dir.
-------------------------------------

[](#your-scripts-in-the-composer-bin-dir)

This plugin allows you to add your own scripts as composer bins to projects.

It works just like dependent packages "bin" scripts work: a link is created from your vendor bin directory to the script.

### Advantages:

[](#advantages)

1. All commands for your project can be run from the same directory, the vendor bin dir.
2. The composer bin dir and autoloader path are available via bash or PHP variables.
3. Scripts can use ensure they are calling exact versions of scripts such as `drush` or `npm` by including this path.

See [Composer "Vendor Binaries" Documentation](https://getcomposer.org/doc/articles/vendor-binaries.md#finding-the-composer-autoloader-from-a-binary) for more information.

Usage
-----

[](#usage)

1. Install the plugin.

    ```
    $ composer require operations/project-bin-scripts

    ```
2. Create a script file.

    ```
    #!/usr/bin/env bash
    # File: scripts/hello-world

    # If your script wants to rely on the other scripts in bin-dir, check for $COMPOSER_RUNTIME_BIN_DIR
    if [[ -z $COMPOSER_RUNTIME_BIN_DIR ]]; then
      echo "ERROR: The COMPOSER_RUNTIME_BIN_DIR environment variable is missing. Run this script from the composer vendor bin directory."
      exit 1
    fi

    # Set the PATH variable to include COMPOSER_RUNTIME_BIN_DIR to allow calling
    # other bin scripts directly.
    PATH=$PATH:$COMPOSER_RUNTIME_BIN_DIR

    echo "Hello World!"
    echo "You are here:"
    pwd

    # To confirm this works, try using "which"
    echo "You are using this drush: "
    which drush
    drush --version
    ```
3. Add to `composer.json`:

    ```
    {
      "bin": [
        "scripts/hello-world"
      ]
    }
    ```
4. Run composer install:

    ```
    $ composer install

    ```
5. Run your script from the composer bin path:

    ```
    ./vendor/bin/hello-world
    ```

    Or, if you set PATH, just use the command.

    ```
    PATH=$PATH:./vendor/bin
    hello-world
    ```

NOTE about composer schema for "bin"
------------------------------------

[](#note-about-composer-schema-for-bin)

This is the same configuration used by `composer.json` schema for dependencies. Using this same config here might cause some confusion.

The main reason this was used is so the plugin could use the exact same code to install project binaries as it does dependency binaries.

If you think this is confusing and should change, please submit a pull request.

About
-----

[](#about)

- Created by: [Jon Pugh](https://github.com/jonpugh)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

Total

3

Last Release

818d ago

Major Versions

1.0.0 → 2.1.02024-01-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/10539fb9e887c35b626eba70c97dd9d53ba14e987d4f129b55a488664a834eca?d=identicon)[jonpugh](/maintainers/jonpugh)

---

Top Contributors

[![jonpugh](https://avatars.githubusercontent.com/u/106420?v=4)](https://github.com/jonpugh "jonpugh (1 commits)")

### Embed Badge

![Health badge](/badges/jonpugh-composer-project-bins/health.svg)

```
[![Health](https://phpackages.com/badges/jonpugh-composer-project-bins/health.svg)](https://phpackages.com/packages/jonpugh-composer-project-bins)
```

###  Alternatives

[vaimo/composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

2994.3M15](/packages/vaimo-composer-patches)[mglaman/composer-drupal-lenient

1317.4M15](/packages/mglaman-composer-drupal-lenient)[drupal/core-composer-scaffold

A flexible Composer project scaffold builder.

5341.9M441](/packages/drupal-core-composer-scaffold)[drupal/core-project-message

Adds a message after Composer installation.

2122.6M172](/packages/drupal-core-project-message)[olvlvl/composer-attribute-collector

A convenient and near zero-cost way to retrieve targets of PHP 8 attributes

184108.8k8](/packages/olvlvl-composer-attribute-collector)[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

41716.4k2](/packages/lullabot-drainpipe)

PHPackages © 2026

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