PHPackages                             devkit/composer-manager - 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. devkit/composer-manager

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

devkit/composer-manager
=======================

Structured Composer script discovery, favourites, and execution from the CLI

1.0.0(1mo ago)16MITPHPPHP ^8.3CI failing

Since Jul 11Pushed 1mo agoCompare

[ Source](https://github.com/stuarttodd-dev/devkit-composer-manager)[ Packagist](https://packagist.org/packages/devkit/composer-manager)[ Docs](https://github.com/stuarttodd-dev/devkit-composer-manager)[ RSS](/packages/devkit-composer-manager/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (9)Versions (2)Used By (0)

 [![Devkit Composer Manager](./devkit-logo.png)](./devkit-logo.png)devkit-composer-manager
=======================

[](#devkit-composer-manager)

Interactive CLI for Composer scripts, dependencies, autoload, config, and repositories — with validation, favourites, and a Symfony TUI.

[![PHP](https://camo.githubusercontent.com/38027453aeb7eb818641c9de8f82b7624c3558d92634f1946edc715c3ddf8956/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php.net/)[![Packagist](https://camo.githubusercontent.com/38416f457d8ecaba3950a167d1dcec557105e5ea12e6a7b1b9173edbcf1bdd08/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6465766b69742f636f6d706f7365722d6d616e616765723f6c6162656c3d7061636b616769737426636f6c6f723d663238643161266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/devkit/composer-manager)[![License](https://camo.githubusercontent.com/3dbbde5f79a33abd50d80ee2476ee9236804a30aea2f11009a427a50ac6ef76c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d323263353565)](LICENSE)[![Tests](https://github.com/stuarttodd-dev/devkit-composer-manager/actions/workflows/php-ci.yml/badge.svg)](https://github.com/stuarttodd-dev/devkit-composer-manager/actions)

---

Table of Contents
-----------------

[](#table-of-contents)

- [Why this exists](#why-this-exists)
- [Prerequisites](#prerequisites)
- [Install](#install)
- [How to run it](#how-to-run-it)
- [Add Composer shortcuts using manage](#add-composer-shortcuts-using-manage)
- [Wire Composer shortcuts manually](#wire-composer-shortcuts-manually-recommended-set)
- [Manage menu reference](#manage-menu-reference)
- [CLI commands reference](#cli-commands-reference)
- [Behaviour notes](#behaviour-notes)
- [Quick test (this repo)](#quick-test-this-repo)
- [Full local setup](#full-local-setup)
- [Development](#development)
- [Support](#support)
- [License](#license)

---

Why this exists
---------------

[](#why-this-exists)

`composer.json` scripts grow over time: test suites, linters, deploy steps, one-off helpers. Listing them with `composer run-script --list` is fine, but **finding**, **running**, **favouriting**, and **editing** scripts — plus dependencies, autoload, config, and repositories — usually means jumping between docs, grep, and hand-editing JSON.

This tool gives you a **single CLI** that walks up to the nearest `composer.json`, shows scripts in a table (with filters and favourites), runs them via `composer run-script`, and offers an interactive **`manage`** hub. On **PHP 8.4+** with **[symfony/tui](https://symfony.com/doc/current/tui.html)** installed, manage uses a full-screen TUI; on PHP 8.3 (or without TUI), the same flows use numbered console menus. Before mutating `composer.json`, it writes **`composer.json.bak`**.

Package: **`devkit/composer-manager`**

---

Prerequisites
-------------

[](#prerequisites)

RequirementVersionPHP**8.3+**Symfony Console / Process**7.x or 8.x** (resolved by Composer for your PHP version)symfony/tui (optional)**8.1+** — full-screen TUI on **PHP 8.4+** onlyComposerany recent (for `run-script`, `require`, `remove`)TerminalANSI + TTY recommended for `manage`Optional: install Symfony TUI (PHP 8.4+)```
composer require symfony/tui:^8.1
```

Without this package (or on PHP 8.3), `manage` still works using console menus and prompts.

---

Install
-------

[](#install)

```
composer require devkit/composer-manager
```

From a clone of this repo```
git clone https://github.com/stuarttodd-dev/devkit-composer-manager.git
cd devkit-composer-manager
composer install
```

Path repository (local development)```
{
  "repositories": [
    {
      "type": "path",
      "url": "../devkit-composer-manager"
    }
  ],
  "require-dev": {
    "devkit/composer-manager": "@dev"
  }
}
```

Then `composer update devkit/composer-manager`.

---

How to run it
-------------

[](#how-to-run-it)

The CLI finds **`composer.json`** by walking up from the current working directory (or from **`--dir` / `-d`**). Run from your **application root**, or pass `--dir` to target another project.

### 1. Install the package

[](#1-install-the-package)

```
composer require devkit/composer-manager
```

### 2. Run the binary

[](#2-run-the-binary)

```
# After composer require (consumer project)
./vendor/bin/devkit-composer-manager --help

# This repo (development)
php bin/devkit-composer-manager --help
```

> **Windows:** use `vendor\bin\devkit-composer-manager.bat` or `php vendor\bin\devkit-composer-manager`.

### 3. Open the interactive manager

[](#3-open-the-interactive-manager)

Needs a real terminal (TTY):

```
./vendor/bin/devkit-composer-manager manage
# or, when stdin is a TTY:
./vendor/bin/devkit-composer-manager
```

### 4. List or run scripts without the menu

[](#4-list-or-run-scripts-without-the-menu)

```
./vendor/bin/devkit-composer-manager list
./vendor/bin/devkit-composer-manager run tests
./vendor/bin/devkit-composer-manager list --filter=test
```

### Default command

[](#default-command)

EnvironmentNo arguments runsTTY (interactive terminal)**`manage`**Non-TTY (CI, pipes)**`list`**### Global option

[](#global-option)

OptionDescription`--dir` / `-d`Directory to start searching for `composer.json` (default: current working directory)### Passing options through Composer scripts

[](#passing-options-through-composer-scripts)

Use `--` before options when calling through `composer run-script` so Composer does not consume them:

```
composer commands:list -- --filter=tests
composer commands:list -- --filter='/^test/' --regex
composer commands:run -- tests --no-interaction
```

### Docker

[](#docker)

Mount your project and run from the app root inside the container:

```
docker compose run --rm -it composer php vendor/bin/devkit-composer-manager manage
```

Ensure `devkit/composer-manager` is installed in that project’s `composer.json`.

---

Add Composer shortcuts using manage
-----------------------------------

[](#add-composer-shortcuts-using-manage)

The easiest way to wire shortcuts is through **manage** itself — no hand-editing JSON.

### Example: add `composer commands:manage`

[](#example-add-composer-commandsmanage)

1. **Open manage** (from your project root):

    ```
    ./vendor/bin/devkit-composer-manager manage
    ```
2. **Main menu** — choose **`Scripts`** (usually option `1`).
3. **Scripts menu** — choose **`Add script`**.
4. **Script name** — enter:

    ```
    commands:manage

    ```
5. **Command line** — enter:

    ```
    vendor/bin/devkit-composer-manager manage

    ```

    Confirm the line when prompted. For a multi-line script, choose **Add another line** after each line; leave the line empty when finished.
6. **Preview** — confirm the summary.
7. **Back** — return to the main menu, then **Exit**.
8. **Test the shortcut**:

    ```
    composer commands:manage
    ```

### Add the rest of the recommended shortcuts

[](#add-the-rest-of-the-recommended-shortcuts)

Repeat **Scripts → Add script** for each row below:

Script nameCommand line`commands:list``vendor/bin/devkit-composer-manager list``commands:run``vendor/bin/devkit-composer-manager run``commands:favourite``vendor/bin/devkit-composer-manager favourite``commands:add``vendor/bin/devkit-composer-manager add``commands:edit``vendor/bin/devkit-composer-manager edit``commands:remove``vendor/bin/devkit-composer-manager remove``commands:manage``vendor/bin/devkit-composer-manager manage``commands:guide``vendor/bin/devkit-composer-manager guide``commands:help``vendor/bin/devkit-composer-manager help``commands:cli``vendor/bin/devkit-composer-manager list-commands`After that you can use `composer commands:list`, `composer commands:manage`, and so on.

**Tip:** star your daily drivers with **Scripts → Toggle favourite**, or `composer commands:favourite add tests`.

---

Wire Composer shortcuts manually (recommended set)
--------------------------------------------------

[](#wire-composer-shortcuts-manually-recommended-set)

Alternatively, paste this into the **consumer** project’s `composer.json`:

```
{
  "scripts": {
    "commands:list": "vendor/bin/devkit-composer-manager list",
    "commands:run": "vendor/bin/devkit-composer-manager run",
    "commands:favourite": "vendor/bin/devkit-composer-manager favourite",
    "commands:add": "vendor/bin/devkit-composer-manager add",
    "commands:edit": "vendor/bin/devkit-composer-manager edit",
    "commands:remove": "vendor/bin/devkit-composer-manager remove",
    "commands:manage": "vendor/bin/devkit-composer-manager manage",
    "commands:guide": "vendor/bin/devkit-composer-manager guide",
    "commands:help": "vendor/bin/devkit-composer-manager help",
    "commands:cli": "vendor/bin/devkit-composer-manager list-commands"
  }
}
```

In **this** repo, the same shortcuts use `@php bin/devkit-composer-manager …` so Composer invokes PHP on the checked-in binary.

---

Manage menu reference
---------------------

[](#manage-menu-reference)

Open with `./vendor/bin/devkit-composer-manager manage` (or `composer commands:manage` once wired).

On **PHP 8.4+** with **symfony/tui**, menus use full-screen lists and a multi-line editor (Ctrl+Enter to submit). Otherwise numbered console menus are used. Destructive or structural changes show a **preview** and ask for confirmation before saving.

### Main menu

[](#main-menu)

\#SectionWhat it does1**Scripts**Add, edit, remove Composer scripts; toggle favourites2**Dependencies (require)**Add/remove production packages3**Dev dependencies (require-dev)**Same as above for `require-dev` (`composer require --dev` / `remove --dev`)4**Autoload**Manage `autoload` PSR-4, classmap, files, exclude-from-classmap5**Autoload dev (autoload-dev)**Same for test/fixture namespaces6**Config**Add, edit, remove Composer `config` settings7**Repositories**Add/remove `path`, `vcs`, or `composer` repositories8**Backups**Create, restore, or delete timestamped `composer.json` snapshots9**Run a script**Pick a script and execute it10**Exit**Leave manage---

### Scripts

[](#scripts)

ActionInstructions**Add script**Enter script name → enter one or more command lines → confirm each line → preview → save. Names use letters, digits, `._:-`.**Edit script**Pick script → line manager (add, edit, remove lines) → save changes or back without saving.**Remove script**Pick script → confirm → removed from `scripts`.**Toggle favourite**Pick script → adds/removes from `extra.devkit-composer-manager.favourites` (shown as `*` in `list`).**Back**Return to main menu.---

### Dependencies / Dev dependencies

[](#dependencies--dev-dependencies)

Both sections work the same; dev uses `require-dev` and passes `--dev` to Composer.

ActionInstructions**Add package**Enter `vendor/package` **or** a search keyword → Packagist search with pagination if keyword → pick version from Packagist releases (or **Any version (\*)**, **Custom constraint**, **Back**) → preview → runs `composer require` (or `require --dev`).**Remove package**Pick package → confirm → runs `composer remove` (or `remove --dev`).**Back**Return to main menu.Packagist search shows package name, description, installs, stars, and a Packagist URL column. Use **Next page**, **Previous page**, **Search again**, or **Exit results** while browsing.

---

### Autoload / Autoload dev

[](#autoload--autoload-dev)

Same actions; **Autoload dev** writes to `autoload-dev`.

ActionInstructions**Add PSR-4 mapping**Namespace (e.g. `App\\`) → directory path (e.g. `src/`) → preview → save. Path must exist under the project.**Add classmap / files path**Choose type: `classmap`, `files`, or `exclude-from-classmap` → enter path → preview → save.**Edit entry**Pick entry → new path → preview → save.**Remove entry**Pick entry → confirm → remove.**Back**Return to main menu.---

### Config

[](#config)

Manages the `"config"` block — Composer behaviour settings (not packages or autoload).

ActionInstructions**Add config key**Pick from documented presets (see table below) or **Custom config key** → read the description → choose from fixed options (boolean/enum) or enter a string/JSON value → preview → save.**Edit config key**Pick key → description shown for known keys → new value → preview → save.**Remove config key**Pick key → confirm → remove.**Back**Return to main menu.**Preset config keys** (available when adding):

KeyPurposeExample value`sort-packages`Sort `require` / `require-dev` keys alphabetically`true``optimize-autoloader`Generate optimized class map for faster autoloading`true``preferred-install`Default install method: `dist` (zip) or `source` (git)`dist``prefer-stable`Prefer stable releases when constraints allow pre-releases`true``allow-plugins`Allow/block Composer plugins by package name`{"vendor/plugin": true}``platform`Pretend the project runs on specific PHP/extension versions`{"php": "8.4.0"}``platform-check`Fail if runtime PHP/extensions don’t match lock file`true``classmap-authoritative`Never fall back to PSR path scanning`true``apcu-autoloader`Cache optimized autoloader in APCu`true``prepend-autoloader`Prepend Composer autoloader to the stack`true``discard-changes`What to do when vendor files would be overwritten`stash``vendor-dir`Where packages are installed`vendor``bin-dir`Where binaries are installed`vendor/bin`Keys already present in `composer.json` are hidden from the preset list. Custom keys accept `true`/`false`, numbers, strings, or JSON objects/arrays.

---

### Repositories

[](#repositories)

ActionInstructions**Add repository**Choose type: `path`, `vcs`, or `composer` → enter URL → preview → save.**Remove repository**Pick repository → confirm → remove.**Back**Return to main menu.---

### Backups

[](#backups)

Snapshots live in `.devkit-composer-manager/backups/`. Every edit also writes a quick **`composer.json.bak`** next to your project file.

ActionInstructions**Create backup now**Optional note → timestamped snapshot saved.**Restore from backup**Pick backup → optionally backup current file first → restore → runs `composer update`.**Delete backup**Pick backup → confirm → delete snapshot file.**Back**Return to main menu.---

### Run a script

[](#run-a-script)

Pick a script from the list → executes via `composer run-script` → returns to main menu when finished.

---

CLI commands reference
----------------------

[](#cli-commands-reference)

Global option on all project-aware commands: **`--dir` / `-d`** — project root to search for `composer.json`.

CommandDescription**`manage`**Interactive hub (see [Manage menu reference](#manage-menu-reference)).**`list`**Table of Composer scripts; favourites show `*` in the first column.**`run`**Run a script by name, or pick interactively.**`favourite`**Add, remove, or list favourite script names.**`add`**Add a script to `composer.json`.**`edit`**Edit an existing script.**`remove`**Remove a script.**`guide`**Short wiring and workflow notes in the terminal.**`list-commands`**Lists this binary’s CLI subcommands (not project scripts).### `list`

[](#list)

```
vendor/bin/devkit-composer-manager list
vendor/bin/devkit-composer-manager list --filter=test
vendor/bin/devkit-composer-manager list --filter='/^test/' --regex
```

OptionDescription`--filter` / `-f`Filter script names (substring, case-insensitive)`--regex`Treat `--filter` as a PCRE pattern (include delimiters)### `run`

[](#run)

```
vendor/bin/devkit-composer-manager run
vendor/bin/devkit-composer-manager run tests
vendor/bin/devkit-composer-manager run --favourites-only
```

Option / argumentDescription`name`Script name (optional — interactive picker when omitted)`--favourites-only`Interactive mode: only offer favourite scripts### `favourite`

[](#favourite)

```
vendor/bin/devkit-composer-manager favourite add tests
vendor/bin/devkit-composer-manager favourite remove tests
vendor/bin/devkit-composer-manager favourite list
```

ArgumentDescription`action`Required: `add`, `remove`, or `list``name`Script name (required for `add` / `remove`; must exist in `scripts`)Favourites are stored in `extra.devkit-composer-manager.favourites`.

### `add`

[](#add)

```
vendor/bin/devkit-composer-manager add --name=qa --line="./vendor/bin/pest"
vendor/bin/devkit-composer-manager add   # interactive prompts
```

OptionDescription`--name`Script name`--line`Command line (repeat for array scripts)### `edit`

[](#edit)

```
vendor/bin/devkit-composer-manager edit tests
vendor/bin/devkit-composer-manager edit tests --line="phpunit" --line="echo done"
```

Option / argumentDescription`name`Script name (optional — picker when interactive)`--line`New lines (replaces entire definition; repeatable)### `remove`

[](#remove)

```
vendor/bin/devkit-composer-manager remove old-script
vendor/bin/devkit-composer-manager remove old-script --force
```

Option / argumentDescription`name`Script name (optional — picker when interactive)`--force`Skip confirmation### Help

[](#help)

```
vendor/bin/devkit-composer-manager help
vendor/bin/devkit-composer-manager help run
composer commands:help run
```

- **`list`** — table of **Composer** scripts in the project.
- **`list-commands`** — this app’s **CLI** subcommands (`run`, `favourite`, `add`, …).
- **`guide`** — install, shortcuts, and examples in the terminal.

---

Behaviour notes
---------------

[](#behaviour-notes)

- **composer.json only** — every read, write, backup, restore, and `composer require`/`remove` targets **`composer.json`** in the project root. The `COMPOSER` environment variable (e.g. `composer.local.json` in Docker) is ignored so this tool always adjusts the same file you commit.
- **Startup** — on load, `composer.json` is repaired (common shape issues) and validated with `composer validate`. Invalid files show errors and exit before the menu opens.
- **Dependencies** — add/remove runs `composer require` / `composer remove` so `composer.lock` stays in sync. Version picker loads stable releases from Packagist when adding a package.
- **Validation** — repositories, autoload paths, config keys/values, script names/lines, package names/constraints, and list filters are validated on input.
- **Symfony TUI** — when `symfony/tui` is installed on PHP 8.4+, filterable full-screen pickers in interactive mode; otherwise console menus.
- **Run** uses `php vendor/bin/composer run-script ` when that file exists, otherwise `composer` on your `PATH`.
- **Backups** — timestamped snapshots in `.devkit-composer-manager/backups/`; quick `composer.json.bak` before each edit; restore can auto-backup current file and runs `composer update`.
- **Favourites** — `extra.devkit-composer-manager.favourites` (legacy `extra.devkit-composer-ui.favourites` and `extra.devkit-composer-commands.favourites` still read).
- Saving `composer.json` may normalise formatting (Composer’s JSON writer).

---

Quick test (this repo)
----------------------

[](#quick-test-this-repo)

From the project root, after dependencies are installed:

```
composer install
php bin/devkit-composer-manager list
composer tests
```

You should see a table of script names and definitions, then passing Pest tests.

**Optional one-liners:**

```
php bin/devkit-composer-manager list --filter=tests
php bin/devkit-composer-manager guide
php bin/devkit-composer-manager help run
php bin/devkit-composer-manager list --dir=/path/to/other/php/project
composer commands:manage
```

---

Full local setup
----------------

[](#full-local-setup)

1. **Get the code and install dependencies**

    ```
    git clone https://github.com/stuarttodd-dev/devkit-composer-manager.git
    cd devkit-composer-manager
    composer install
    ```
2. **Automated tests**

    ```
    composer tests
    ```
3. **Docker (optional)**

    ```
    docker compose build --no-cache --pull
    docker compose run --rm app php -v   # must show PHP 8.3.x
    docker compose run --rm app php bin/devkit-composer-manager list
    docker compose run --rm -it app php bin/devkit-composer-manager   # interactive manage
    docker compose run --rm app composer tests
    ```

    The image is `php:8.3-cli` with Composer installed. The project is mounted at `/src`, so local edits are visible in the container. Rebuild after pulling changes: `docker compose build --no-cache --pull app`.

    For TUI testing inside Docker, use a PHP 8.4 image and run `composer require symfony/tui:^8.1` in the container.

---

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

[](#development)

```
composer run tests
composer run standards:check
```

---

Support
-------

[](#support)

If this project saves you time, consider buying me a coffee:

[![Buy Me a Coffee](https://camo.githubusercontent.com/2d46bf14a397821eb518fb5a37197f9a4fbff0ddcb1734dfe2e0211a942e4b10/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275792532304d6525323061253230436f666665652d737570706f72742d4646444430303f6c6f676f3d6275792d6d652d612d636f66666565266c6f676f436f6c6f723d626c61636b)](https://buymeacoffee.com/stuarttodd)

---

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance90

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

48d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/54860041?v=4)[Stuart Todd](/maintainers/stuarttodd-dev)[@stuarttodd-dev](https://github.com/stuarttodd-dev)

---

Top Contributors

[![stuarttodd-dev](https://avatars.githubusercontent.com/u/54860041?v=4)](https://github.com/stuarttodd-dev "stuarttodd-dev (1 commits)")

---

Tags

composercliworkflowscriptssymfony-console

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/devkit-composer-manager/health.svg)

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

55344.7k5](/packages/jolicode-castor)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.8M685](/packages/shopware-core)[illuminate/console

The Illuminate Console package.

13046.6M7.5k](/packages/illuminate-console)[whatsdiff/whatsdiff

See what's changed in your project's dependencies

761.4k](/packages/whatsdiff-whatsdiff)

PHPackages © 2026

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