Skip to content

[6.x] Honour the COMPOSER env var when locating composer.json and its lock file - #15362

Merged
jasonvarga merged 1 commit into
6.xfrom
composer-env-var
Sep 3, 2026
Merged

jasonvarga merged 1 commit into
6.xfrom
composer-env-var

Conversation

@duncanmcclean

Copy link
Copy Markdown
Member

This pull request fixes an issue where Statamic would error when the COMPOSER environment variable points Composer at a different composer.json file (eg. COMPOSER=composer.local.json).

This was happening because Statamic hard-coded composer.json and composer.lock paths. Composer names the lock file after the configured JSON file (composer.local.jsoncomposer.local.lock), so Version::get() couldn't find a lock file and threw on every request, and statamic:install reported a missing pre-update-cmd hook because it was reading a composer.json that no longer existed.

This PR fixes it by resolving the filenames the same way Composer does. Json::filename() reads the COMPOSER environment variable (falling back to composer.json) and Lock::filename() derives the lock filename from it. Everywhere Statamic previously assumed composer.json or composer.lock now goes through these, including the update scripts, starter kit installer/exporter and make:addon.

Fixes #10592

…ock file

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cgc3YjCDAFAX66aHANrFEB
@jasonvarga
jasonvarga merged commit 0b5cd04 into 6.x Sep 3, 2026
65 checks passed
@jasonvarga
jasonvarga deleted the composer-env-var branch September 3, 2026 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hard-coded dependency on composer.json blocks different composer environments

2 participants