Skip to content

feat: add lerd cpx - #1548

Open
geodro wants to merge 1 commit into
mainfrom
feat/1543-cpx
Open

feat: add lerd cpx#1548
geodro wants to merge 1 commit into
mainfrom
feat/1543-cpx

Conversation

@geodro

@geodro geodro commented Aug 23, 2026

Copy link
Copy Markdown
Member

cpx is to Composer what npx is to npm, a way to run a command from any Composer package without adding it to the project. Routing it through lerd is what makes it run on the PHP version the site is registered on rather than whatever PHP the host happens to have, the same reason lerd wraps composer and artisan.

Worth saying plainly: most of this already worked before the command existed. Requiring cpx globally makes lerd sync a shim onto PATH like it does for any composer global binary, and lerd already execs with HOME set to the host's home, so the packages cpx fetches cache under ~/.cpx and survive a container restart. What the command adds is the explicit form and an error worth reading, since without it a missing cpx fails inside the container with "could not open input file" rather than naming the one command that fixes it.

The binary is resolved through the same COMPOSER_HOME and XDG lookup the global bin sync uses, so a non-default composer home is followed rather than guessed at.

Confirmed against a real project on 8.5, running a package the project does not have:

$ lerd cpx phpstan/phpstan analyse app --level=1
{"tool":"phpstan","result":"passed","errors":0}

Note the package is cpx/cpx, not laravel/cpx as the repo name suggests.

Closes #1543

cpx is to Composer what npx is to npm, a way to run a command from any Composer package without adding it to the project. Routing it through lerd is what makes it run on the PHP version the site is registered on rather than whatever PHP the host happens to have, which is the same reason lerd wraps composer and artisan.

Most of this already worked before the command existed. Requiring cpx globally makes lerd sync a shim onto PATH like it does for any composer global binary, and lerd already execs with HOME set to the host's home, so the packages cpx fetches cache under ~/.cpx and survive a container restart. What the command adds is the explicit form and an error worth reading: without it, a missing cpx fails inside the container with "could not open input file" rather than naming the one command that fixes it.

The binary is resolved through the same COMPOSER_HOME and XDG lookup the global bin sync uses, so a non-default composer home is followed rather than guessed at.

Closes #1543
@geodro
geodro requested a review from a team as a code owner August 23, 2026 15:20
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.

Add lerd cpx command

1 participant