Requirements
- PHP 8.3 or higher
- Composer
- Git
gh) or the GitLab CLI (glab) is optional. When your project doesn’t have a Git remote yet, the ship and deploy commands can use either one, if you’re signed in, to create the repository for you. This is only available when running interactively. The CLI can’t create Bitbucket repositories, so if you use Bitbucket, create the repository yourself and add it as a remote before shipping.
Installation
Install the CLI globally:$PATH environment variable, you can read more about this in the Composer documentation.
Shell completions
The CLI supports tab completions for Bash, Zsh, and Fish. To generate and install completions for your shell, run:Authentication
Before using the CLI, you need to authenticate with your Laravel Cloud account. You can authenticate through your browser, provide an API token through an environment variable, or save API tokens on your machine.Browser authentication
The simplest way to authenticate is through your browser:~/.config/cloud/config.json.
Token authentication
In CI/CD pipelines and other environments without a browser, provide an API token through theLARAVEL_CLOUD_TOKEN environment variable:
LARAVEL_CLOUD_TOKEN is set, it takes precedence over any tokens saved in ~/.config/cloud/config.json, and the CLI writes nothing to disk. An empty value counts as unset, so you can bypass the variable for a single command without unsetting it:
Saving tokens
On a machine you return to, or when you need tokens for several organizations, you may save tokens to~/.config/cloud/config.json using the auth:token command. You can pass the token using the --token option or pipe it to the command:
--remove option accepts a token in the same way:
--show-sensitive to print them in full.
If you have saved tokens for multiple organizations, the CLI prompts you to select an organization when running commands. In non-interactive environments, set a default organization for your repository using cloud repo:config --organization instead. When LARAVEL_CLOUD_TOKEN is set, the --organization option becomes a check rather than a choice: repo:config fails if the token doesn’t belong to the organization you named.
Quick start
The fastest way to get an application running on Laravel Cloud is theship command. From inside your project directory, run:
.env variables, creates databases or caches, and configures features like the scheduler, Octane, or WebSockets.
You may skip some of the prompts by passing options to the ship command:
Each application belongs to a repository and a root directory. If an application already exists for the same repository and root directory,
ship offers to deploy it instead. When running non-interactively, ship stops and prints the ID of the existing application, which you may pass to cloud deploy.
Deploying
To deploy your application, run thedeploy command from your project directory:
--no-wait option. The CLI prints the deployment ID so you can check on it later:
deploy non-interactively in a repository that doesn’t have a Laravel Cloud application yet, the CLI runs ship to create one. When running interactively, it asks before doing so.
Deployment history
To list an environment’s deployments, view a deployment’s details, or view a deployment’s build and deploy logs:deployment:logs command shows each build and deploy step with its status, duration, and output, so you can see which step caused a failed deployment and why.
Repository configuration
To avoid specifying your application and organization on every command, you can save defaults for your repository:.cloud/config.json file in your project root that stores the application_id and organization_id. Subsequent commands will use these defaults automatically.
Managing resources
The CLI provides full CRUD operations for Laravel Cloud resources. Command examples below show the most common operations.Applications
Environments
laravel.cloud subdomain, pass only the first part of the domain. For example, --name=my-app gives my-app.laravel.cloud. The previous domain stops working right away, but the new domain only takes effect on the next deployment, so pass --deploy to deploy the environment right away. You can change the domain once every 30 minutes. When running non-interactively, the command requires the --force option:
environment:purge-edge-cache. By default, everything cached at the edge is purged. To purge a single path, every path under a prefix, or a Cache-Tag value, use the --path, --prefix, or --tag option. Purging by tag requires a dedicated edge network:
Instances
Databases
Caches
Object storage
Domains
WebSockets
Background processes
Managed queues
Managed queues are a special kind of instance, so these commands accept an instance ID. If you don’t pass one, the CLI prompts you to select a queue:managed-queue:create command accepts the --name, --size, --max-workers, --visibility-timeout, --polling-interval, and --shutdown-timeout options, so you can create a queue non-interactively.
To list, retry, or delete a managed queue’s failed jobs:
pause, purge, and delete-failed-job commands accept the --force option to skip the confirmation prompt.
Secrets
Secrets are encrypted values shared across your organization that can be attached to environments:secret:create and secret:update commands read the secret’s value from STDIN when the --value option isn’t given, which keeps the value out of your shell history:
sodium extension. Some Linux distributions ship this extension as a separate package.
Commands
To run a one-off command on an environment:Tinker
Thetinker command opens an interactive PHP REPL connected to your Laravel Cloud environment, allowing you to execute PHP code directly against your running application:
Editor mode
If you prefer to write code in your editor, use the--editor option:
code, subl, vim, and phpstorm. If no value is given, the VISUAL or EDITOR environment variable is used.
Non-interactive mode
To execute a single snippet of PHP code without entering the interactive session, use the--code option:
Timeout
By default, code execution will time out after 60 seconds. You can adjust this with the--timeout option:
Metrics and usage
To view metrics for an environment, database cluster, cache, WebSocket cluster, or WebSocket application:--period option to choose 6h, 24h, 3d, 7d, or 30d:
--detailed for a full breakdown by application, resource, and add-on, --environment to filter usage by environment, or --period to view a different billing period. The --period option accepts current, previous, 1, 2, or 3:
Utility commands
Open your application in the Laravel Cloud dashboard:Agent skills
The CLI can install Laravel Cloud skills for your AI coding agents. Skills are fetched from thelaravel/agent-skills repository and installed into the appropriate directory for each agent.
Global vs. project installation
By default, skills are installed to the current project if the Cloud CLI is installed as one of its Composer dependencies, and globally otherwise. You can override this behavior:Specifying agents
To install skills for specific agents without being prompted:Overwriting existing skills
If skills have already been installed, use the--force flag to overwrite them:
JSON output
Many commands support a--json flag for machine-readable output, which is useful for automation and CI/CD pipelines:
STDOUT, and errors are written to STDERR, so you can pipe the output to tools like jq without filtering out error messages.
Sensitive values, such as environment variables, database and cache passwords, bucket secret keys, WebSocket application secrets, and API tokens, are masked by default. Pass --show-sensitive to reveal them:
--json also disables interactive prompts. In non-interactive environments, such as GitHub Actions and other CI services, prompts are disabled and output is formatted as JSON automatically. Destructive commands, such as environment:delete, require the --force option when run without a terminal, so they never run without your explicit approval.
List commands return at most the first 2,000 results. When a list reaches this limit, the CLI prints a warning.
