PHPackages                             rollandrock/composer-interaction - 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. rollandrock/composer-interaction

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

rollandrock/composer-interaction
================================

v0.1.1(6y ago)09MITPHPPHP ^7.4

Since Jan 17Pushed 6y ago1 watchersCompare

[ Source](https://github.com/pierrerolland/composer-interaction)[ Packagist](https://packagist.org/packages/rollandrock/composer-interaction)[ RSS](/packages/rollandrock-composer-interaction/feed)WikiDiscussions master Synced 4w ago

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

Add interaction to composer create-project
==========================================

[](#add-interaction-to-composer-create-project)

[![Build Status](https://camo.githubusercontent.com/b716b40c917a1edc6d71d832232d1b92d717b15cc7490b7b0647ece3cfd6865d/68747470733a2f2f7472617669732d63692e6f72672f706965727265726f6c6c616e642f636f6d706f7365722d696e746572616374696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/pierrerolland/composer-interaction)

This composer plugin allows your `composer create-project` command to ask some information that would be necessary to either install optional new packages, or replace some placeholders after the installation.

With a piece of configuration set in your application skeleton's `composer.json`, composer will ask any kind of question, and perform actions accordingly.

Plus, the plugin auto-destroys after the project has been created, leaving your final `composer.json` clean.

Usage
-----

[](#usage)

Add the following line in your skeleton's `composer.json`:

```
{
  "require": {
    "rollandrock/composer": "^1.0"
  },
  "extra": {
    "rollandrock-interaction": {
      "questions": [
        {
          "type": "add-package",
          "question": "Would you like to do stuff?"
        },
        {
          "type": "replace",
          "question": "What is the name of your dog?"
        }
      ]
    }
  }
}
```

---

### Questions configuration

[](#questions-configuration)

There are currently two actions that will follow your questions: "add-package" and "replace".

#### add-package

[](#add-package)

This action will install all the packages needed if the user that installs the project answers "yes" to the question. It can also add environment variables that would be needed by your project (optional). Here is an example of configuration for that kind of questions:

```
{
  "action": "add-package",
  "question": "Would you like to add a bundle to help you configure RabbitMQ vhosts?",
  "packages": {
    "olaurendeau/rabbit-mq-admin-toolkit-bundle": "^2.0"
  },
  "env": {
    "RABBITMQ_USER": "rollandrock"
  }
}
```

If the user answers "yes", composer will install `olaurendeau/rabbit-mq-admin-toolkit-bundle` and add `RABBITMQ_USER` to the `.env` file.

The configuration of `add-package` questions can also have a `reference` property, that will allow conditional questions to be asked. See [conditional questions section](#conditional-questions).

#### replace

[](#replace)

This action will search for a given placeholder and replace it with the user's answer. Questions can have two types, "free" or "choice". If "choice" is selected, you'll need to add an extra key "choices". Example:

```
{
  "action": "replace",
  "question": "What is the application's name?",
  "type": "free",
  "placeholders": [
    {
      "file": "config/parameters.yaml",
      "placeholder": "{APP_NAME}"
    }
  ]
},
{
  "action": "replace",
  "question": "What is the application's type?",
  "type": "choice",
  "choices": ["api", "worker", "service"],
  "placeholders": [
    {
      "file": "config/parameters.yaml",
      "placeholder": "{APP_TYPE}"
    }
  ]
}
```

---

#### Conditional questions

[](#conditional-questions)

Each question can have a `if` property. In this case, the question will be asked if the referenced boolean question (`add-package` ones) has received the `yes` answer.

Example:

```
[
    {
        "reference": "rmq",
        "action": "add-package",
        "question": "Would you like to install RabbitMQ?",
        "packages": {
           "swarrot/swarrot-bundle": "*"
        }
    },
    {
        "if": "rmq",
        "reference": "rmq-config",
        "action": "add-package",
        "question": "Would you like to add a bundle to help you configure RabbitMQ vhosts?",
        "packages": {
           "olaurendeau/rabbit-mq-admin-toolkit-bundle": "^2.0"
        }
    },
    {
        "if": "rmq-config",
        "action": "replace",
        "question": "What is the application's name?",
        "type": "free",
        "placeholders": [
            {
              "file": "config/parameters.yaml",
              "placeholder": "{APP_NAME}"
            }
        ]
    }
]
```

Here, the second question will be asked only if the user answers yes to the first one. Same, the third question will be asked only if the user answers yes to the other ones.

---

### Auto-removal

[](#auto-removal)

This plugin self destroys after the project has been created. Which means the plugin's require and the extra config won't appear in the final `composer.json`.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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

Total

2

Last Release

2303d ago

### Community

Maintainers

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

---

Top Contributors

[![pierrerolland](https://avatars.githubusercontent.com/u/2700109?v=4)](https://github.com/pierrerolland "pierrerolland (8 commits)")

### Embed Badge

![Health badge](/badges/rollandrock-composer-interaction/health.svg)

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

###  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.3M14](/packages/vaimo-composer-patches)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[altis/local-server

Local Server module for Altis

18208.4k2](/packages/altis-local-server)[vaimo/composer-changelogs

Provide information about package changes based on changelog files that are bundled with releases; provide tools for generating documentation files from changelog sources

11150.5k10](/packages/vaimo-composer-changelogs)[aedart/athenaeum

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

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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