laravel/cloud-cli
Laravel Zero CLI to deploy and manage apps on Laravel Cloud. Authenticate via OAuth, link repos, ship and deploy from the terminal, and manage environments, databases, caches, object storage, and domains, with optional JSON output and shell completions.
The laravel/cloud-cli package is a Laravel Zero application, meaning it is a lightweight, self-contained CLI tool built on Laravel’s ecosystem. This aligns well with Laravel-based projects, particularly those leveraging Laravel Cloud for hosting, as it provides a native integration with the platform’s API and workflows. The CLI abstracts complex API interactions (e.g., OAuth, environment management, deployments) into human-readable commands, reducing cognitive load for developers.
Key architectural strengths:
application, environment, database), enabling granular control over Laravel Cloud infrastructure.cloud ship) and machine-readable JSON output (e.g., cloud environment:list --json), catering to CI/CD pipelines and automation.gh) dependency: Tightly couples with GitHub for repo linking, assuming projects are version-controlled via GitHub (common for Laravel projects).Integration feasibility depends on the target stack:
Laravel Projects:
cloud deploy and cloud ship designed for Laravel applications. Assumes:
artisan commands, .env files).cloud repo:config command links a Git repo to a Laravel Cloud app, enabling context-aware deployments (e.g., auto-selecting the correct app/environment).Non-Laravel Projects:
.env files, artisan hooks). While it could theoretically manage infrastructure (e.g., databases, caches), it lacks generality for non-Laravel stacks.CI/CD Pipelines:
# GitHub Actions example
- name: Deploy to Laravel Cloud
run: php vendor/bin/cloud deploy --json
cloud auth:token for CI-friendly authentication (avoids browser-based OAuth).| Risk Area | Assessment | Mitigation Strategy |
|---|---|---|
| Dependency Lock-in | Relies on Laravel Cloud API and GitHub CLI. Changes to either could break the CLI. | Monitor Laravel Cloud API deprecations; abstract API calls behind interfaces if extending the CLI. |
| GitHub Dependency | Requires gh CLI for repo linking. Projects not on GitHub (e.g., GitLab, Bitbucket) are unsupported. |
Document workaround (e.g., manual repo config) or explore GitLab CLI alternatives. |
| PHP Version | Requires PHP 8.2+. Older Laravel projects may not be compatible. | Enforce PHP 8.2+ in CI/CD; provide downgrade guidance if needed. |
| Authentication | OAuth flow requires browser access (problematic for headless CI). | Use cloud auth:token with pre-generated tokens in CI. |
| Repo Configuration | Assumes Git repo structure. Non-standard repos (e.g., monorepos) may cause issues. | Validate repo structure in cloud repo:config; add error handling for edge cases. |
| Laravel-Specific | Commands like cloud deploy assume Laravel’s deployment workflow (e.g., artisan commands). Non-Laravel apps may need custom scripting. |
Provide hooks for custom deployment scripts; document limitations. |
| Shell Integration | Requires manual alias setup (~/.zshrc/~/.bashrc). |
Offer composer global installation option or package as a laravel-zero global command. |
Target Audience:
CI/CD Strategy:
Git Hosting:
Deployment Workflow:
artisan commands), or are custom scripts needed?Scaling:
Maintenance:
The laravel/cloud-cli is optimized for Laravel-based stacks using Laravel Cloud. It fits best in the following scenarios:
| Stack Component | Fit Level | Notes |
|---|---|---|
| Laravel Applications | High | Native support for Laravel’s deployment workflows (e.g., artisan, .env files). Commands like cloud ship and cloud deploy are Laravel-aware. |
| Laravel Cloud | Native | Direct API integration for managing apps, environments, databases, caches, etc. |
| GitHub Repositories | High | Uses gh CLI for repo linking; assumes GitHub-hosted code. |
| PHP 8.2+ | High | Minimum requirement aligns with modern Laravel versions. |
| Composer | High | Installed as a Composer dependency or global CLI tool. |
| CI/CD (GitHub Actions) | High | Supports JSON output and token-based auth for automation. |
| Non-Laravel Apps | Low | Limited utility; infrastructure management (e.g., databases) is possible but lacks Laravel-specific optimizations. |
| GitLab/Bitbucket | Low | No native support; workarounds required for repo linking. |
If adopting this CLI, follow this phased migration approach:
Install and Test:
gh repo clone laravel/cloud-cli
cd cloud-cli
composer install
cloud auth
cd /path/to/laravel-app
cloud repo:config
Test Core Workflows:
cloud ship or cloud deploy.Document Gaps:
ssh/scp deployments to cloud deploy.cloud command:run.cloud deploy --json in pipelines.- name: Deploy to Laravel Cloud
run: php vendor/bin/cloud deploy --json
env:
CLOUD_TOKEN: ${{ secrets.LARAVEL_CLOUD_TOKEN }}
How can I help you explore Laravel packages today?