- How do I install and set up Laravel Cloud CLI for Laravel projects?
- First, clone the `laravel/cloud-cli` repo and run `composer install`. Then, add a shell alias (e.g., `alias cloud='php /path/to/cloud-cli/cloud'`) to your `.zshrc` or `.bashrc`. Authenticate with `cloud auth` and link your GitHub repo using `cloud repo:config` from your project root.
- Does Laravel Cloud CLI support Laravel 10+ and PHP 8.2+?
- Yes, the CLI requires PHP 8.2+ and is optimized for Laravel applications. It integrates seamlessly with Laravel’s deployment workflows, including Artisan commands and `.env` configurations, ensuring compatibility with modern Laravel versions.
- Can I use Laravel Cloud CLI in CI/CD pipelines like GitHub Actions?
- Absolutely. Use `cloud auth:token` to generate an API token for non-interactive authentication. Store the token securely (e.g., GitHub Secrets) and run commands like `cloud deploy` directly in your CI pipeline. Example workflows are available in the documentation.
- What happens if I don’t run `cloud repo:config`?
- Without `cloud repo:config`, you’ll need to specify the application, environment, and other details manually for every command. The CLI detects Git repos and stores defaults in `.git/config`, so running `repo:config` once streamlines future workflows.
- How do I manage multiple Laravel Cloud environments (e.g., staging, production) with this CLI?
- Use the `--environment` flag with commands like `cloud deploy --environment=production`. Alternatively, set defaults per repo with `cloud repo:config --environment=staging`. The CLI prompts for missing context if no defaults are configured.
- Is Laravel Cloud CLI secure for production deployments? How are API tokens handled?
- API tokens are stored encrypted in `~/.config/cloud/config.json`. For CI/CD, use short-lived tokens or integrate with secrets managers like HashiCorp Vault. Always enforce least-privilege access and rotate tokens regularly. The CLI avoids hardcoding sensitive data in scripts.
- Can I use Laravel Cloud CLI for non-Laravel PHP projects or other PaaS platforms?
- The CLI is tailored for Laravel applications, assuming Artisan, `.env`, and Laravel-specific deployment artifacts. While it won’t work natively with non-Laravel projects, you could adapt it for other PaaS platforms by extending the underlying API abstraction layer.
- How do I debug failed deployments or get JSON output for scripting?
- Use the `--json` flag for machine-readable output (e.g., `cloud deploy --json`). For debugging, check the CLI’s error messages and integrate with Laravel’s logging (e.g., Logflare) or Sentry. The `cloud deploy:monitor` command helps track rollout status.
- What are the alternatives to Laravel Cloud CLI for Laravel deployments?
- Alternatives include Laravel Forge (for server management), Deployer (generic PHP deployment), or custom scripts using Laravel Cloud’s API directly. However, Laravel Cloud CLI is the official, Laravel-optimized tool for managing Laravel Cloud resources, offering built-in GitHub integration and streamlined workflows.
- How can I extend Laravel Cloud CLI for custom workflows or third-party services?
- The CLI is built on Laravel Zero, so you can extend it by creating custom commands or plugins. For third-party services, use the `--json` output to parse data and integrate with APIs. Contribute to the project or fork it to add support for Laravel Vapor or other platforms.