webkernel/lifecycle

Environment Checks

Sur cette page

A check describes a failed environment requirement and how Lifecycle should react. Built-in workers run declared checks before install/update and after autoload generation, whenever the plugin is active for those events.

1. Declare a failure condition

{
  "extra": {
    "webkernel": {
      "lifecycle": {
        "checks": [
          {
            "check": "PHP_VERSION_ID < 80500",
            "on-fail": {
              "type": "danger",
              "message": "PHP 8.5 or newer is required."
            },
            "fix": "Run Composer with PHP 8.5 or newer."
          }
        ]
      }
    }
  }
}

The comparison means failure when true. Here, PHP below 8.5 triggers danger; PHP 8.5 or newer passes. It checks the PHP process running Composer, not another PHP binary used by a web server.

2. Choose the severity

TypeResultComposer operation
infoInformational failure message.Continues.
warningWarning message.Continues.
dangerBlocking failure message and exception.Stops immediately.

fix is optional text shown with a failure. It is never executed, even if it looks like a command. A passing comparison reports PASS. The runner also reports totals and elapsed time.

Supported expressions

The current language accepts PHP_VERSION_ID, one comparison operator and a non-negative integer. It supports ===, ==, !==, !=, <, <=, >, and >=. It does not accept function calls, extension checks, boolean combinations or arbitrary PHP. Expressions are parsed as data.

Keep mandatory platform requirements in Composer's require section. Lifecycle checks add phase-specific messages; they cannot protect an event that occurs before the local plugin is installed. See Composer-time and Runtime.

Ordering

The check runner follows declaration-reader order: root first, then the installed repository's package order. Within each package, checks keep list order. A blocking check prevents later checks and the following action phase from running.

Next step

Read Writing Actions, or consult the exact check reference.