Deploying with Laravel Cloud CLI
Setup
sh
composer global require laravel/cloud-cli
cloud auth -n
Commands
Commands follow a CRUD pattern:
,
,
,
,
.
Available resources:
,
,
,
,
,
,
,
,
,
,
,
.
Some resources have additional commands (e.g.,
,
,
,
). Discover these via
.
Never hardcode command signatures. Always run
to discover options at runtime.
CLI Flags
Always add
to every command — prevents the CLI from hanging.
Never use
or
— they suppress all output.
Flag combos per operation:
- Read (, ) →
- Create () →
- Update () →
- Delete () → (no )
- Environment variables →
- Deploy/ship → with all options passed explicitly (no )
Deployment Workflow
Determine the task and follow the matching path:
First deploy? →
(discover options via
)
Existing app? →
sh
cloud repo:config
cloud deploy {app_name} {environment} -n --open
cloud deploy:monitor -n
Environment variables? →
cloud environment:variables -n --force
Provision infrastructure? →
cloud <resource>:create --json -n
Custom domain? →
cloud domain:create --json -n
then
For multi-step operations, see reference/checklists.md.
Not sure what the user needs? → ask them before running anything.
When a Command Fails
- Read the error output
- Check resource status with or
- Auth error? →
- Fix the issue, re-run the command
- If the same error repeats after one fix, stop and ask the user
Always run
after every deploy. If it fails, show the user what went wrong before attempting a fix.
Subagent Delegation
Delegate high-output operations to subagents (using the Task tool) to keep the main context window small. Only the summary comes back — verbose output stays in the subagent's context.
Delegate these to a subagent:
- — deployment logs can be very long
cloud deployment:get --json -n
— full deployment details
cloud <resource>:list --json -n
— listing many resources produces large JSON
- Fetching docs from https://cloud.laravel.com/docs/llms.txt via
Keep in the main context:
- Short commands like , , — output is small
- — you need the deployment ID immediately
- Any command where you need the result for the next step right away
Rules
Follow exact steps:
- Flag selection — always use the documented combos above
- Deploy sequence — deploy then monitor, never skip monitoring
- Destructive commands — always confirm with user first, show the command and wait for approval
- Error loop — diagnose, fix once, ask user if it fails again
Use your judgment:
- Instance sizes, regions, cluster types — ask the user if not specified
- Which resources to provision — based on what the user describes
- Order of provisioning — no strict sequence required
- How to present output — summarize, show raw, or extract fields based on context
Remote Access
Tinker (> v0.2.0)
Run PHP code directly in a Cloud environment:
sh
cloud tinker {environment} --code='Your PHP code here' --timeout=60 -n
- — PHP code to execute (required in non-interactive mode)
- — max seconds to wait for output (default: 60)
The code must explicitly output results using
,
, or similar — expressions alone produce no output.
Always pass
and
to avoid interactive prompts.
Remote Commands
Run shell commands on a Cloud environment:
sh
cloud command:run {environment} --cmd='your command here' -n
- — the command to run (required in non-interactive mode)
- — skip real-time output streaming
- — copy output to clipboard
Review past commands:
cloud command:list {environment} --json -n
— list command history
cloud command:get {commandId} --json -n
— get details and output of a specific command
Delegate
to a subagent when output may be long.
Config
- Global:
~/.config/cloud/config.json
— auth tokens and preferences
- Repo-local: — app and environment defaults (set by )
- CLI arguments override both
Documentation
When the user asks how something works or needs an explanation of a Laravel Cloud feature, fetch the docs from the URL above using
and use it to provide accurate answers.
When Stuck
- Fetch https://cloud.laravel.com/docs/llms.txt for official documentation
- Run for any command's options
- Run to discover commands