docs / CLI reference
CLI reference
One binary, ten commands, and a deploy surface that refuses rather than guesses. Exit codes are part of the contract.
Commands
| command | what it does | notes |
|---|---|---|
| laravel-workers build | compile the app to dist/ | --strict (default in the guided path), --scaffold writes a 501 stub port per unanswered route, --no-cache skips the cache hit check |
| laravel-workers deploy | build, then (on request) D1 and the Cloudflare deploy | see the deploy page: --plan, --mode, --d1-auto, --d1-id, --skip-schema, --schema=apply, --name, --yes, --allow-account-change |
| laravel-workers init | scaffold registry.json + wrangler.jsonc, idempotent | never overwrites an existing file |
| laravel-workers status | what is recorded in lw-state.json: worker, URL, D1, account, when | exits 2 when the state file is damaged instead of pretending there is no deployment |
| laravel-workers doctor | preflight: php, vendor, wrangler, deploy state | --cloud also resolves the Cloudflare account and compares it with the recorded one |
| laravel-workers shadow | proof harness: real PHP app vs the compiled worker, byte-wise | --app <root> |
| laravel-workers verify | php tools/verify-s0.php | SKIP when there is no parent vendor/ |
| laravel-workers vendor:ensure | provision a composer-free vendor tree | CI prewarm |
| laravel-workers php:ensure | resolve or provision the PHP interpreter | CI prewarm |
Without the package installed, prefix every command with npx. Developer tasks are package scripts, not subcommands: npm test, npm run test:corpus,npm run test:sqlite, npm run bench, npm run gate:cpu,npm run check:docs.
Deploy flags
| flag | effect |
|---|---|
| --plan | preview only: no build, no writes, no cloud mutation; exit 0 if actionable, 2 if a real run would stop |
| --check | with --plan: add read-only account verification and d1 list / table-count calls |
| --mode 1|2|3 | build only / + database / + deploy |
| --name <worker> | set the worker name (modes 2/3) without a prompt |
| --d1-auto | create or reuse <worker>-db, capped to D1’s 63-character limit |
| --d1-id <uuid> | use a specific existing D1 (mutually exclusive with --d1-auto) |
| --skip-schema | never apply dist/schema.sql; conflicts with --schema=apply |
| --schema=apply | force-apply dist/schema.sql even when the D1 has tables |
| --deploy / --db | shorthands for --mode 3 / --mode 2 |
| --allow-account-change | continue on a different Cloudflare account than lw-state.json records |
| --yes, -y | accept every default, never prompt (schema drift and an unconfirmed account change still stop) |
Any other --flag is forwarded to build (for example--no-cache). --dry-run is rejected with a --plan hint — it is not a synonym.
Exit codes
| code | meaning |
|---|---|
| 0 | success; for --plan, no blocking issue found |
| 1 | operational failure: build, wrangler create/execute/deploy, an unreadable table count or whoami, an incomplete --plan --check |
| 2 | usage/config/state refusal: bad flags, missing artisan, invalid JSONC, corrupt state, missing D1, account mismatch, schema drift under --yes |
When nothing prompts
--yestakes every default. A D1 with tables and no recorded schema hash stops (exit 2), because the state cannot be verified.- Non-TTY with neither
--modenor a D1 flag defaults to mode 1 — build only, never touching Cloudflare. - A D1 flag without
--modeon a non-TTY implies mode 2: database, no deploy. --namealone is not a cloud mode; with build-only it is rejected, because build-only does not editwrangler.jsonc.
Version and machine output
laravel-workers --version prints one plain line when stdout is not a terminal, so scripts can read it. On a TTY it prints the mark above it; NO_COLOR andFORCE_COLOR choose either way.
shellshell
laravel-workers --version # 0.4.10
laravel-workers help # the same text the binary printsSource: README.md §CLI, §deploy — bin/laravel-workers.mjs — repository ba1e9a5