laravel-workersv0.4.10
documentation

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

commandwhat it doesnotes
laravel-workers buildcompile 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 deploybuild, then (on request) D1 and the Cloudflare deploysee the deploy page: --plan, --mode, --d1-auto, --d1-id, --skip-schema, --schema=apply, --name, --yes, --allow-account-change
laravel-workers initscaffold registry.json + wrangler.jsonc, idempotentnever overwrites an existing file
laravel-workers statuswhat is recorded in lw-state.json: worker, URL, D1, account, whenexits 2 when the state file is damaged instead of pretending there is no deployment
laravel-workers doctorpreflight: php, vendor, wrangler, deploy state--cloud also resolves the Cloudflare account and compares it with the recorded one
laravel-workers shadowproof harness: real PHP app vs the compiled worker, byte-wise--app <root>
laravel-workers verifyphp tools/verify-s0.phpSKIP when there is no parent vendor/
laravel-workers vendor:ensureprovision a composer-free vendor treeCI prewarm
laravel-workers php:ensureresolve or provision the PHP interpreterCI 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

flageffect
--planpreview only: no build, no writes, no cloud mutation; exit 0 if actionable, 2 if a real run would stop
--checkwith --plan: add read-only account verification and d1 list / table-count calls
--mode 1|2|3build only / + database / + deploy
--name <worker>set the worker name (modes 2/3) without a prompt
--d1-autocreate 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-schemanever apply dist/schema.sql; conflicts with --schema=apply
--schema=applyforce-apply dist/schema.sql even when the D1 has tables
--deploy / --dbshorthands for --mode 3 / --mode 2
--allow-account-changecontinue on a different Cloudflare account than lw-state.json records
--yes, -yaccept 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

codemeaning
0success; for --plan, no blocking issue found
1operational failure: build, wrangler create/execute/deploy, an unreadable table count or whoami, an incomplete --plan --check
2usage/config/state refusal: bad flags, missing artisan, invalid JSONC, corrupt state, missing D1, account mismatch, schema drift under --yes

When nothing prompts

  • --yes takes every default. A D1 with tables and no recorded schema hash stops (exit 2), because the state cannot be verified.
  • Non-TTY with neither --mode nor a D1 flag defaults to mode 1 — build only, never touching Cloudflare.
  • A D1 flag without --mode on a non-TTY implies mode 2: database, no deploy.
  • --name alone is not a cloud mode; with build-only it is rejected, because build-only does not edit wrangler.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 prints

Source: README.md §CLI, §deploy — bin/laravel-workers.mjs — repository ba1e9a5