Composer dependencies are locked
php/lockfile-committed@v1
The project commits composer.lock, so an install of the same commit resolves the same versions.
| Id | php/lockfile-committed |
| Version | v1 |
| Category | php |
| Default severity | warning |
| Interpreter | python3 |
| Timeout | 30 seconds |
| Violations tolerated | 0 |
| Collects | php |
Collectors
This guardrail gathers nothing itself. It depends on the collectors below, which the CLI runs once per build before any check, and reads what they found out of GUARDRAIL_FACTS. A collector that collects nothing skips this guardrail rather than failing it.
| Collector | Gathers | Inputs it is given |
|---|---|---|
php | The Composer project in the project directory: the package it declares, the PHP version and extensions it asks for, the packages it requires and which of them are pinned, and whether the lock file is committed. | projectDir |
The inputs above are this guardrail's own, passed straight through. Configuring one in buildnote.json changes what is collected, and two guardrails configured the same way share the one collection.
Configuration
{
"guardrails": {
"failOn": "error",
"comment": true,
"checks": [
{
"use": "php/lockfile-committed@v1",
"severity": "warning",
"with": {
"projectDir": "."
},
"exemptions": []
}
]
}
}Inputs
| Input | Description | Default | Environment variable |
|---|---|---|---|
projectDir | Directory holding the project, relative to the directory the CLI runs in. | . | GUARDRAIL_INPUT_PROJECTDIR |
How to fix
Commit the lock file Composer writes:
composer update
git add composer.lockA ^7.0 requirement resolves to whatever the registry serves that day, so without composer.lock an application installs differently on every deploy and the versions that shipped are not the versions that were reviewed.
More in php
php/dependencies-constrained. Every package the manifest requires names a version constraint, rather than accepting whatever the registry serves.php/version-declared. The project declares the PHP version Composer resolves against, and that version is no older than the configured floor.